How to not load some variables

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to not load some variables

539 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by v0ynich on Tue Jun 23 01:54:57 MST 2015
Hello,

Is it possible to not load a part of my code by using some kind of macro or any lpcxpresso configuration? Lets say I have a look up table in flash (const) that I don't want to load everytime I change the program code. How can I do that?

Thank you
Labels (1)
0 Kudos
6 Replies

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by v0ynich on Tue Jun 23 09:05:39 MST 2015
Yes, you are right. I'm now avoiding the address used for the checksum in BankB.

Regarding the post build steps:

If I have the BankB divided in several sections (I'm allocating the variable addresses manually), can I do something like this?

arm-none-eabi-objcopy  --only-section .section1 --only-section .section2 --only-section .section3 -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_BankB.axf"

arm-none-eabi-objcopy --remove-section .section1 --remove-section .section2 --remove-section .section3 -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.axf"


Many thanks!
0 Kudos

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jun 23 06:20:16 MST 2015
No, I don't believe that this will work - the IAP call to configure the part to boot from BankA (which basically means setting the checksum word in BankA) will also zero the checksum word in bankB.

Regards,
LPCXpresso Support
0 Kudos

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by v0ynich on Tue Jun 23 06:10:25 MST 2015
Hello!

I will give it a try! Thank you.


Quote:
Warning: Ensure that the first part of the data you are putting into BankB does not contain data you care about, as the act of configuring the part to boot from BankA - which is done by the flash programmer - will overwrite the word at offset 0x1c. Please see the LPC43xx User Manual chapter on flash programming for more details (IAP command - set active flash bank).



This is valid if I program BankB before BankA. Otherwise it will work, right? (assuming that BankB is not bootable)
0 Kudos

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Tue Jun 23 05:24:12 MST 2015
So as suggested by whitecoe, you could use objcopy to remove from the generated AXF the section matching onto bankB.

You'll need to look at the disassembly of the AXF to see the appropriate section name
http://www.lpcware.com/content/faq/lpcxpresso/disassembling-objects-and-executables

but you could then add a post-build step to your project containing these (untested) lines:

arm-none-eabi-objcopy --only-section .text_Flash2 -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_BankB.axf"

arm-none-eabi-objcopy --remove-section .text_Flash2 -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.axf"


http://www.lpcware.com/content/faq/lpcxpresso/post-processing-linked-application

This should generate an AXF image with the postfix "_BankB" containing just your constant data, which you can program separately when required into BankB using the GUI flash programmer :

  http://www.lpcware.com/content/faq/lpcxpresso/gui-flash-programming-tool

And the modified "standard" AXF which will get launched by the debugger has been modified to remove the constant data.

Warning: Ensure that the first part of the data you are putting into BankB does not contain data you care about, as the act of configuring the part to boot from BankA - which is done by the flash programmer - will overwrite the word at offset 0x1c. Please see the LPC43xx User Manual chapter on flash programming for more details (IAP command - set active flash bank).

Regards,
LPCXpresso Support
0 Kudos

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by v0ynich on Tue Jun 23 03:55:24 MST 2015
Thank you for your answer.

I have look up tables on flash bank B that I don't want to touch during the programming (for debug purposes) of flash bank A. However, the program in flash bank A needs to use those look up tables. Is there any practical way of doing this?

Thank you
0 Kudos

504 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by whitecoe on Tue Jun 23 02:51:47 MST 2015
With the speed of flash programming to LPC43xx using LPC-Link2 with the latest LPCXpresso, is this really worth doing? Certainly I'm seeing download speeds around 80-90KB/s here.

Otherwise you could look at using the objcopy utility to strip the section containing the const data you don't want to program. But you might still have to be careful to ensure that your constant data is placed into a different flash sector to the rest of your application (i.e. probably right at the end). Otherwise it could still end up being erased. This may well require you to modify the default managed linker script : http://www.lpcware.com/content/faq/lpcxpresso/own-linker-scripts

And if you have a really really massive application, you could also look at using LPCScrypt to program your image, then use an attach only debug session : http://www.lpcware.com/content/faq/lpcxpresso/debugging-running-system

Anyway if you describe your software and target system setup in more detail, perhaps someone can provide more specific advice.

HTH!
0 Kudos