Run code from power on Link2 dev board

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

Run code from power on Link2 dev board

5,244 Views
QM
Contributor II

Hi NXP community, 

I have two link2 boards working as a debug/target configuration. When I load code onto my target board and debug it, it works fine. However, when I unplug the power and plug it back in again the code doesn't run properly. 

How do I go about figuring out when my issue is? I have tested example code such as the led blinky one, which works as expected (starts blinking at power on). I do notice the example code stores in flash, and needs to be booted with JP1 connected to work, whereas my code doesn't seem to be storing in flash. 

Is the best solution to store my code in flash like the example? or is there a simpler way of telling the program where to start in my code after power on?

Thanks in advance, 

Quinn

0 Kudos
12 Replies

4,821 Views
QM
Contributor II

Hi NXP, 

I still don't have a solution to my problem but I am getting closer to solving it. Like I mentioned in a previous post I believe I have successfully configured my linkscripts to download my code from my flash to my RAM when I power on my board. 

However, I can see with my debugger that the code is still executing from flash and not from RAM as the main starts from an address around 0x14000000, which is the start of my flash memory.

What should I change next to get my code to start from the main that it downloads to RAM and not from the main in flash?

Regards,

Quinn 

0 Kudos

5,231 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

HI,

On your target board, pls check the JP1 jumper on the LPC link2 board, I suppose you have to close the JP1.

Pls have try.

Hope it can help you

BR

XiangJun Rong

 

0 Kudos

5,229 Views
QM
Contributor II

Hi XiangJun,

I have tried with JP1 connected but I don’t think I am storing my code to flash so doing this doesn’t change anything.

Quinn

0 Kudos

5,225 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Pls check if you download application code to on-chip SRAM or external quad SPIFI flash on the target board by checking the link file.

BR

XiangJun Rong

0 Kudos

5,217 Views
QM
Contributor II

Hi XiangJun, 

It looks like I am loading code into SRAM. Please see the images attached of my linker file and MCU settings menu in properties > C/C++ Build > MCU Settings (in MCUExpresso).

Regards, 

Quinn

Tags (1)
0 Kudos

5,206 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have checked the link file, the application code is put in on-chip RAM, if you want to run the code after power off and on, you have to put the code in external SPIFI flash.

Hope it can hjelp you

BR

XiangJun rong

 

0 Kudos

5,203 Views
QM
Contributor II

Hi XiangJun, 

I am running from RAM because it I believe it allows me to execute code faster than if the code was stored in external flash. 

I have read on some other forum posts that I could place a dummy main() into flash which then calls the real main() in RAM. Would this be a viable solution which does not affect the performance of the code in RAM? Would you be able to assist me in configuring my program in MCUXpresso to make this happen? 

I do eventually want to design a system which only uses the LPC4370 without external flash. I find it hard to believe that the only way to program this chip and have it run after reset properly is with the code in an external flash, but I could be wrong.

-Quinn

0 Kudos

5,198 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Yes, the external spifi flash is required, the application code must be saved in flash so that the code can remain after power off.

Hope it can help you

BR

XiangJun Rong

0 Kudos

5,172 Views
QM
Contributor II

Ok yes, I see what you are saying. Is it possible to download and run code from flash to RAM on power on? 

- Quinn

0 Kudos

5,089 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Yes, it is okay to download and run code from flash to RAM on power on.

BR

XiangJun Rong

0 Kudos

4,862 Views
QM
Contributor II

Hi XiangJun Rong,

Can I get some more help with my issue?

I have read the MCUXpresso guide and followed the steps in 17.15.1 "Relocating majority of an application to RAM." I now have a folder in the project called link scripts with the necessary files mentioned in that section of the guide. 

My code is now running from flash, which is a good step I think as I know now that I am able to save it to the flash. Now it seems like its still not running the code from RAM like I want. It could be copying it to RAM but still running from flash, not entirely sure.

Any suggestions on what to try next?

Regards, 

Quinn

0 Kudos

5,023 Views
QM
Contributor II

Ok so how do I do this?

I have copied the flash configuration used in the Blinky example project for the link2 into my project. It seems to be loading some of the code into the flash but my program still doesn't run as expected.

Please see attached are three images of the storage used after building my program. One with no flash configured, one with flash configured, and an image of the MCU settings for the storage and flash configuration. The one with flash seems to have copied half of my code into flash, but I haven't specified anywhere what should be copied to where. 

Can you suggest some things I need to consider moving forward, or some guide I could follow for getting my code to download to flash during debug and run from RAM?

Thanks, 

Quinn

0 Kudos