AnsweredAssumed Answered

flash erase

Question asked by huck lim on Jan 12, 2018

Hello everyone,

I need help from all the MCU expert out there.

I want to download the bootloader code and the firmware code of the STM8s207CBT6 microcontroller. My target (the microcontroller)'s Data-EEPROM, Bootloader, and Flash firmware program have already been programmed. I want to re-program the Bootloader and the firmware code only. The Data in the Data-EEPROM should remain as it is. I am using the commandline stmflashloader to 'download' the bootloader and the firmware code. The following are the commands I am using:

stmflashloader.exe -c --pn 1 --br 115200 --db 8 --pr EVEN --sb 1 --ec OFF --to 2000 -i STM8_128K -d --fn "Bootloader.s19" --v -r --a 8000
stmflashloader.exe -c --pn 1 --br 115200 --db 8 --pr EVEN --sb 1 --ec OFF --to 2000 -i STM8_128K(user-bootloader) -d --fn "firmware.s19" --v

They works.

My concern is,

1. do I need to use the -e (to erase the memory) in the command? I suppose it is better to erase the memory before downloading the new code. I am not using it because I don't know how to specify it.

2. If I specify -e --all (which means to erase all the memory), does it erase the DATA EEPROM area too?

3. Is DATA EEPROM part of the flash memory?

4. I am downloading the bootloader code between address 0x008000 - 0x008C00 and firmware code between 0x009000 - 0x022400. I read from the manual that the DATA EEPROM is from 0x004000 - 0x0047FF, but I don't know if the -e --all include erasing the DATA EEPROM memory. If I use the -e --sec option, do I need to specify all the pages (that will be 256 pages), a very long command indeed.


Thank you very much in advance to all the experts.

yours sincerely,