I have a bootloader and application. My application is laid out like so:
Bytes 0-3: 32-bit Length Field
Bytes 4-(Length-5): Application code
Bytes (Length - 4)-(Length -1): CRC32
Right now, the length field is larger than it needs to be, just so I don't have to think about expanding it in my linker properties as I add more features. This means that several sectors towards the end of my application space are not used, and set to 0xFF by the linker.
The bootloader verifies the CRC of the application space, including all the "blank" sectors, before launching the application, and this works fine when I program through my IDE (IAR), but when I program the same image through J-Flash, the bootloader receives a dabort indicating an ECC error (ESMSR3 is 0x00000080) when it tries to read some bytes in the sectors that have nothing but 0xFF values.
I have done some experimenting, and I have at least two workarounds:
1. Only set the length field in the application to as long as I need it be, so no sector covered by my length field goes totally unused.
2. Change the linker properties to set unused areas to something besides 0xFF, e.g. 0xA5.
These workarounds are OK, but I was wondering why it appears the ECC is not being initialized on sectors that are explicitly set to nothing but 0xFF values. My hypothesis is that the J-Flash does not actually "write" the 0xFF values in a sector that contains nothing but that value, it just erases the sectors, which does not trigger the automatic ECC generation. Is that correct? Is there a way to ensure that the correct ECC values are generated for all sectors in an image, regardless of contents?
Bytes 0-3: 32-bit Length Field
Bytes 4-(Length-5): Application code
Bytes (Length - 4)-(Length -1): CRC32
Right now, the length field is larger than it needs to be, just so I don't have to think about expanding it in my linker properties as I add more features. This means that several sectors towards the end of my application space are not used, and set to 0xFF by the linker.
The bootloader verifies the CRC of the application space, including all the "blank" sectors, before launching the application, and this works fine when I program through my IDE (IAR), but when I program the same image through J-Flash, the bootloader receives a dabort indicating an ECC error (ESMSR3 is 0x00000080) when it tries to read some bytes in the sectors that have nothing but 0xFF values.
I have done some experimenting, and I have at least two workarounds:
1. Only set the length field in the application to as long as I need it be, so no sector covered by my length field goes totally unused.
2. Change the linker properties to set unused areas to something besides 0xFF, e.g. 0xA5.
These workarounds are OK, but I was wondering why it appears the ECC is not being initialized on sectors that are explicitly set to nothing but 0xFF values. My hypothesis is that the J-Flash does not actually "write" the 0xFF values in a sector that contains nothing but that value, it just erases the sectors, which does not trigger the automatic ECC generation. Is that correct? Is there a way to ensure that the correct ECC values are generated for all sectors in an image, regardless of contents?
The post was edited 1 time, last by sams: Typo in address ().