This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fill flash with data

My program in flash end at some point. From that endpoint on I'd like to fill up the whole flash with 0xff.

Something like

.equ FlashDictionaryEnde,   0x00100000

.equ numberofbytes , FlashDictionaryEnde-.
.space numberofbytes,0xff

doesn't work.

How can I achieve this?

Parents
  • It sounds like you are expecting that you can write 0xFF to a location that has something else in it, and having it actually leave 0xFF there. Programming can only turn 1's into 0's. To turn 0's back into 1's, you have to erase. Or maybe I'm misunderstanding you. Or are you saying you want to use 0xFFs to skip over some area that is already programmed? That would probably work, but some programmers might complain if they include verification in the programming operation.

    As to your asm question, I'm no ARM assembler expert, but in general, subtracting a symbol from a constant only works if the symbol has a non-relocatable value. I'm not sure the ARM assembler even provides a way to create code at absolute addresses, so the subtraction won't produce a meaningful value. Perhaps it just defaults to zero, although I would expect at least a warning. This is the sort of thing you could do with a linker script, because the linker is what assigns physical addresses, and it has a FILL directive. If, however, the program only has one module, and you know it will eventually be flashed starting at address 0, you could define a symbol at the start of the module, and subtract that from your expression, because the difference between . and that start symbol would indeed be an absolute quantity.

Reply
  • It sounds like you are expecting that you can write 0xFF to a location that has something else in it, and having it actually leave 0xFF there. Programming can only turn 1's into 0's. To turn 0's back into 1's, you have to erase. Or maybe I'm misunderstanding you. Or are you saying you want to use 0xFFs to skip over some area that is already programmed? That would probably work, but some programmers might complain if they include verification in the programming operation.

    As to your asm question, I'm no ARM assembler expert, but in general, subtracting a symbol from a constant only works if the symbol has a non-relocatable value. I'm not sure the ARM assembler even provides a way to create code at absolute addresses, so the subtraction won't produce a meaningful value. Perhaps it just defaults to zero, although I would expect at least a warning. This is the sort of thing you could do with a linker script, because the linker is what assigns physical addresses, and it has a FILL directive. If, however, the program only has one module, and you know it will eventually be flashed starting at address 0, you could define a symbol at the start of the module, and subtract that from your expression, because the difference between . and that start symbol would indeed be an absolute quantity.

Children