2025-11-20 6:28 AM - last edited on 2025-11-21 5:22 AM by mƎALLEm
when trying to program our hex file in the microcontroller with the actual version 2.21 of programmer, I get following error:
failed to download Sector[0].
in hex file the sector 0 starting from address 0x0 is used.
wondering, that this could not be programmed with stm tools.
| sw tool | hw tool | result |
| stm programmer | st-link | error |
| stm programmer | j-link | error |
| j-flash pro | j-link | error |
| j-flash light | j-link | good |
in my opinion, the definition file for programmer isn't correct.
the sector 0 is missing. why?
shall it be corrected?
thanks for fast help.
Stefan
2025-11-20 7:12 AM
> in hex file the sector 0 starting from address 0x0 is used.
Address 0 is not always a valid flash address. Your hex file should write to 0x08000000. Perhaps your linker file has mistakes.
2025-11-20 7:51 AM
thanks for the answer. what I now better understand:
- the memory at address 0 is mapped from sram, system memory or main flash memory.
- we have set nBOOT1 to one. so we use system memory to boot-up from.
- to flash, we want to reprogram the system memory area to write our own bootloader and startup
- there is no "normal" way to program this system memory area.
- so now I think the system area shall be added into the definition file?
- or does stm don't want to let user write into this area?
Thanks for responding
Stefan
2025-11-20 8:22 AM - edited 2025-11-20 8:22 AM
The system bootloader is in ROM. It is not writeable.
When user bootloaders are used, they are placed at the start of flash (0x08000000) so they boot up first. The application is placed further on.
2025-11-20 8:40 AM
Hello,
The error “failed to download Sector[0]” usually indicates that the programming tool cannot access or erase the first sector of the microcontroller. Since your hex file uses Sector 0 starting at address 0x0, the problem is likely related to the programmer’s definition file or memory mapping.
From your table, it seems only J-Flash Light with J-Link succeeds, which supports the idea that other tools’ programmer definitions don’t correctly include Sector 0. This is not a fault of your hex file it’s a mismatch in the tool’s configuration.
Yes, the definition file should be corrected to include Sector 0. Meanwhile, using J-Flash Light or another tool that supports Sector 0 is a safe workaround.
2025-11-21 2:52 AM
I am a little confused. for better clarify for me:
- is the system memory writeable on stm32f072 ?
- where will be written into sector 0, when system memory is not writeable?
- can someone provide an updated database file for st-programmer for additionally section 0 and system memory section? so I can determine what is really written in all the sections
thanks for help
stefan
2025-11-21 3:21 AM
I would agree, it looks like some programming tools have erraneously included 0x00000000 as valid sector address.
It is also my understanding that the MCU maps other memory (Flash, ROM or RAM) to this address at startup, depending on the boot pin configuration.
> - can someone provide an updated database file for st-programmer for additionally section 0 and system memory section? so I can determine what is really written in all the sections
These are most probably XML files, in a subdirectory of the tool's installation folder.
I would try to identify the responsible file, and edit it manually if possible.
Besides of filing a bug report.
2025-11-21 6:12 AM
As already stated in my last post, system memory is ROM and is not writeable.
Instead of writing to address 0, write to a non-ambiguous address such as 0x08000000 for flash. What appears at address 0 depends on the configuration of your chip and how it boots up. It is not a reliable way to program the device.
2025-11-26 12:48 AM - edited 2025-11-28 1:16 AM
Once again or detailed information:
- we write into sector 0, during flashing
- the project is created and finalized before I came to company
- most of the developers are not even more in company
- and others forgot or never know most of the special details
so I need a changed programmer definition file, to verify what happens, when writing into sector 0
I am not familiar with these xml definitions
Can someone professional provide me the file expanded to all sections?!