My program in flash end at some point. From that endpoint on I'd like to fill up the whole flash with 0xff.
.equ FlashDictionaryEnde, 0x00100000
.equ numberofbytes , FlashDictionaryEnde-.
How can I achieve this?
Are you still looking for help with this?
I have the same issue. and Am also looking solution.
Since 0xFF is the erased state of the flash, the obvious choice would simply be not to program the flash past the end of the code. This can be done if you can produce a binary file of the correct length, or a hex file that only contains data up to that offset, which is what the toolchain usually produces. Actually programming lots of 0xFFs into the flash wastes time.
Yes, sure. But when you program the flash without erasing it - there are situations, where you program the flash in two steps at different addresses, it could well be desirable to pad the space after the program with 0xff.
My question was actually aiming at the ARM assembler syntax to use in order to fill exactly the amount of data longing from the end of the program to the end of the flash. That's why I posted a piece of assembler instructions that were syntactically probbly wrong but which should show what I meant.
Looks like you didn't get any solution.
Yes. It couldn't be that difficult to find the right assembler instructions. Maybe I'll have to figure it out myself...
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.
Some programmers can be set to fill unused space.
Or you could post-process the Hex file...
@ellamacrow , I will wait your response. Thanks in advance
I finally found a solution using assembly langage instructions.
ARM GAS simple.s page 1
1 .syntax unified
2 .cpu cortex-m4
4 .global Reset,Loop
5 .equ ram, 0x20000000
6 .equ dict,0x188
7 .equ stack,0x20000300
9 .org 0
10 .align 2
11 0000 00030020 .long stack
12 0004 00000000 .long Reset
13 0008 00000000 .skip 0x400
15 0408 B618 adds r6, r2
16 040a 0A04 lsls r2, r1, #16
17 040c 4FF4C471 ldr r1,=dict
18 @ ldr r0,=ram+4
19 0410 0160 str r1, [r0]
20 @ ldr r0, = Loop
21 0412 00BF Loop: nop
22 0414 FFF7FEBF b Loop
23 .set here,.
24 0418 18040000 .word here
25 .equ endflash,0x10000
26 041c 5A5A5A5A .org endflash,0x5a5a
Don't care about the nonesense code stuff. Importand is the
.org value,fill the resulting .bin file is filled up to the end of flash with the desired data.
All well and good, what you are saying, but my original question was not whether it is a good idea or not to fill flash with data 0xff , but what the assembly language construct would be to achieve my goal (fill the flash with arbitrary data).
And I found the answer myself. Thank you.
View all questions in GNU Toolchain forum