2015-06-15 04:57 AM
hej
i would like to keep some file in a seperate place at flash where linker dont use it when put the code in the flash.i am using COIDE., stm32f407 discovery board.Can anyone tell me how can i do that ?thank you.2015-06-15 05:13 AM
i would like to keep some file in a separate place at flash where linker don't use it when put the code in the flash. i am using COIDE., stm32f407 discovery board.
Not sure I understand the question.What sort of file, a source file, some data?There's linker scripts, memory regions, and compiler level directives and #pragmas2015-06-15 05:31 AM
clive,
what i meant was, i need to have some place to put some data and after that i want to read or write a new value in that place. i want a space to be constant on the flash all the time. something similar like (''writeuserblock() or readuserblock() functions at rapid processor''). thank you2015-06-15 05:49 AM
Shrink the flash allocation in the linker script, and place your data into the space freed up at the end, say an 8K or 16K section depending on your needs, and the size of the flash blocks.
2015-06-15 06:42 AM
i tried to do it but it still doesnot work..
my flash address is ORIGIN = 0x08000000end = 0x080F FFFF ......LENGTH = 100000i shrink 16kb : 3FFFthe below one is my space after shrinking;rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x000FC001i tried to write from address 0x080FC003 .....but it does not write anything.can you help me to fix this problem ?...thank you2015-06-15 07:28 AM
That would be 0x4000
For the upper blocks of the F4 you have 128K (0x20000) size blocks, this is the minimum erase size. You should be able to write byte/word(s) using the usual FLASH commands. Please refer to the examples in the peripheral library as a starting point, and in a similar fashion as the OTP writes covered with you earlier.2015-06-15 07:54 AM
2015-06-15 08:21 AM
As Clive said you can not shrink just 16KB from the end, the sectors in the end are 128KB in size, see this table from the reference manual:
Sector 0 0x0800 0000 - 0x0800 3FFF 16 Kbytes Sector 1 0x0800 4000 - 0x0800 7FFF 16 Kbytes Sector 2 0x0800 8000 - 0x0800 BFFF 16 Kbytes Sector 3 0x0800 C000 - 0x0800 FFFF 16 Kbytes Sector 4 0x0801 0000 - 0x0801 FFFF 64 Kbytes Sector 5 0x0802 0000 - 0x0803 FFFF 128 Kbytes Sector 6 0x0804 0000 - 0x0805 FFFF 128 Kbytes . . Sector 11 0x080E 0000 - 0x080F FFFF 128 Kbytes This may also help you.2015-06-15 08:54 AM
0x100000 - 0x4000 = 0xFC000
You can't put data at 0x08000000, you have to place at least two vectors there for the part to start properly. I'd put a boot loader there, and then use the 16 KB blocks (sectors) after that for configuration data.You could push the application code to start at 0x08008000, 0x0800C000, or 0x08010000 depending on your actual requirements.You could skip the boot loader / application configuration, but this would require you carve a hole in the memory space the linker uses, and complicates things. I've covered this in numerous threads before, so you could review some of those.2015-06-16 12:52 AM
thank you again clive,
i could put the application code to the address which u mentioned. but i dont know about boot loader as i am very new to this. where can i find the bootloader and change the start address?could you give procedure or put some sample.