Content originally posted in LPCWare by lpcxpresso-support on Wed Sep 17 03:28:37 MST 2014
The attached example project demonstrates how you can use a single project to create the images to load into both the internal and external SPIFI flashes on LPC4088. It has been created in a workspace containing the projects previously posted above, and is basically a quick port of that previous example into a single project.
The project has been modified in a number of ways from how created using the LPCOpen C project new project wizard.
Firstly, the memory configuration editor (documented in the LPCXpresso User Guide) has been used to add a second flash bank (the SPIFI device). You should locate this as the second flash in the list, as displayed in the editor.
Secondly, the function in dummy.c has been prefixed with the __TEXT(Flash2) macro, to place the function into the second flash bank
Finally, the post build step has been modified to generated a binary containing the code to be placed in the SPIFI flash bank
[list]
[*]http://www.lpcware.com/content/faq/lpcxpresso/post-processing-linked-application
[/list]
The commands being used in this case are:
arm-none-eabi-size "${BuildArtifactFileName}" cp "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_ORIGINAL.axf" arm-none-eabi-objcopy --only-section .text_Flash2 --rename-section .text_Flash2=.text -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_EXTFLASH.axf" arm-none-eabi-objcopy -O binary "${BuildArtifactFileBaseName}_EXTFLASH.axf" "${BuildArtifactFileBaseName}_EXTFLASH.bin" arm-none-eabi-objcopy --remove-section .text_Flash2 -O elf32-littlearm "${BuildArtifactFileName}" "${BuildArtifactFileName}" arm-none-eabi-size "${BuildArtifactFileName}" arm-none-eabi-size "${BuildArtifactFileBaseName}_EXTFLASH.axf" |
What these do are:
[list=1]
[*]Generate size information for the whole project
[*]Take a copy the generated whole project AXF for future reference (optional), as we are going to modify the AXF
[*]Generate an AXF from the whole project AXF containing only the code being placed into the SPIFI flash.
[*]Generate a binary of the SPIFI flash AXF. This could be combined into the previous step, but it can be useful to have access to the AXF as well as the binary.
[*]Generate a binary containing only the code/data being placed into the internal flash. This overwrites the original whole project AXF and will be used when we start a debug session.
[*]Display size information of the two AXFs that match the two flash types.
[/list]
To use this project, first of all build as normal.
Then select the LPC4088_Combined_EXTFLASH.bin file in the Project Explorer view, and click on the GUI flash programmer tool on the main icon bar
[list=1]
[*]http://www.lpcware.com/content/faq/lpcxpresso/gui-flash-programming-tool
[/list]
Select the LPC407x_8x_S25FL032P.cfx flash driver you have previously placed into the LPCXpresso bin directory, and enter 0x28000000 in the base address field. Then hit OK. You should then see a log confirming the LPC4088_Combined_EXTFLASH.bin has been programmed.
Having done this, you can then launch a debug session as normal, and the main code will be downloaded into the internal flash and you can then debug/run this as normal.
If you prefer, then once you have everything working as per above, you could change from using the GUI flash programming tool for downloading to the SPIFI flash to using the command line programmer - either from a command line prompt, or by adding it as a "Pre launch command" entry for the debugger in your launch configuration. For more details, please see:
[list]
[*]http://www.lpcware.com/content/faq/lpcxpresso/command-line-flash-programming
[*]http://www.lpcware.com/content/faq/lpcxpresso/launch-configuration-menu
[/list]
Regards,
LPCXpresso Support