Bootloader-less Pro - Advanced AVR 3.0 Core - Part 2 - SPM erase self destruction code

Channel:
Subscribers:
580
Published on ● Video Link: https://www.youtube.com/watch?v=nYljQqCLeL0



Duration: 2:20
7 views
0


A tiny bit of code can be written in the end of program memory space to self erase itself relatively easily for whatever reason. This demonstrates how to use spm from application section with simple inline asm and simple c. z-register shifted right 6 is the page address for 32 words page size mcu. 2^7=128 bytes per page; 6:0=7 bits.

ps. dummy who wrote avr-boot header uses a byte-address to point to a page, which works, but very dumb.

PPS. there are tons of dummies trying to use inline asm to show off their smartness. If you are a dummy, code written by you are trash regardless if you are using c or asm. Here the SPM function is mainly written in c. It's clean and clear and more portable and it compiles just as good.

PPPS. Self-written to self in the application seems to fail when the code is initialized from the application section even when the spm code is within the bootloader section using c, but if one failed, then a new route will be explored. A hard code method should technically be fail free.




Other Videos By Flyandance


2023-03-21Bare Minimal 2 | .init0 | naked | .ctors | signal | -nostartfiles - Advanced AVR 3.0 Core
2023-03-20Bootloader self-program - Juno AVR109 Rewrite Part 1 - Advanced AVR 3.0 Core
2023-03-19Bootloader self-program - AVR109 speed test avrdude - Advanced AVR 3.0 Core - 1Mbps with 8MHz CPU
2023-03-18Bootloader self-program - AVR109 w/ AVROSP and avrdude - Advanced AVR 3.0 Core
2023-03-17SPM 3.0 writes to self - Advanced AVR 3.0 Core Bootloader
2023-03-16SPM 2.0 writes to self - Advanced AVR 3.0 Core Bootloader
2023-03-14You jump, ijmp - Inline asm Indirect Jump - Advanced AVR 3.0 Core Bootloader
2023-03-05yt-dlp - A ultimate guide (The result of 2 weeks of hard work)
2023-03-03True bare Minimal code - Advanced AVR 3.0 Core Bootloader Pro Part 4 Size does matters getting naked
2023-02-28Bootloader-less Pro - Advanced AVR 3.0 Core - Part 3 - SPM - App Writes to App section - programmer
2023-02-27Bootloader-less Pro - Advanced AVR 3.0 Core - Part 2 - SPM erase self destruction code
2023-02-26Inline ASM - Advanced AVR 3.0 Core - LMP read from flash Load Program Memory
2023-02-25Inline ASM - Advanced AVR 3.0 Core - Finalizing
2023-02-22Inline ASM - Advanced AVR 3.0 Core
2023-02-19Bootloader-less Pro - Advanced AVR 3.0 Core - Part 1 - GCC Sections functions attribute
2023-02-17Script cowboy - the power of one line of code
2023-02-15Bootloader Pro - Advanced AVR 3.0 Core - AVR-C 2.0 sucks BBC
2023-02-11Juno ABC - Advanced Button Core 4.0 - Sleep mode ultra low power
2023-02-07My Coffee ritual 2.0 - Simple Minimalistic - Dry milk + sugar
2023-02-03Sleep mode - Advanced AVR 3.0 - Atiny13 watchdog less than 100nA - Peripheral leakage current Button
2023-02-02Definition of good soup - Chicken Turmeric