Forum : ARM
Original Post
Post Information | Post |
---|---|
April 13, 2010 - 9:42am
|
Hello I want to place AES encryption/decryption functions at FLASH page 0 to 3 and a simple main function that calls an application at FLASH page 4. And I want to be able to call the AES functions from the application. I know how to modify the linker script to place code at the right place (page 0-3 or from page 4 forward). But how do I link the AES functions to the application code so that it knows where they are located? And how do I tell the compiler to not optimize away my AES-functions (because the program in page 0-3 doesn't use them self). |
Hi
I am not sure I understand the first question:
I am missing why while building one application would you have to specify to the another function where another function is located.
Also may I ask you on which target are you working.
Concerning the second question I think this can be achieved from linker options
"LD linker->General-> Remove unused secrtions"
Regards
Matloub
I'm using an STM32F103 device (64K FLASH).
I must use read out protection and also be able to self reprogram the FLASH memory. So the application can't self program page 0 - 3 or the device will apply a mass erase of the entire FLASH.
So I thought that I place a simple main() in page 0-3 that calls the reset vector pointed out by page 4 (and only use page 4-63 for my application). But this leaves some un used space in page 0-3. So i tought I could use that space for some functions (the AES functions).
And now I want to be able to call the AES functions at page 0-3 from my application at page 4-63. How do I do that?
This will unfortunately also include some other unused functions from ST firmware library.
I solved it by calling all AES functions at least once from main() in page 0-3. That way they are not lost.
Hi Sima
For your first question may be my colleagues will have a suggestion.
For second question if you use ST firmware library, you are write this won' be a good solution.
But as you have placed some of your code in a specific address, you might have declare some sections to do so.
In that case you might KEEP() linker script instruction to make sure that they are not removed.
This is done for instance in sections_FLASH.ld in our default linker script available under:
C:\Program Files\Raisonance\Ride\lib\arm
Regards
Matloub