Code runs in debug-ram and debug-flash, but not out of flash

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

Code runs in debug-ram and debug-flash, but not out of flash

1,018 Views
david_brooks
Contributor II

Follow-up question to post #443262: I'm converting "C" code from CW V6.4 to V10.4. This code is a Functional Board Tester, not the V10.4 application that actually goes out the door. But I'm using the V10.4 linker file, modified slightly to "talk" to the V6.4 mcf5282_lo.s and sysinit.c files. I think the root of my problem is related to this conversion. The code runs great now on V10.4 when debugging in ram and in flash. But when I disconnect the programmer/debugger (USB Universal FX), the code does not run out of flash on power up or upon hard reset. I've tried everything, but think I am missing something simple. BTW: RCON is pulled to ground with a 1K resistor. Hardware sets the processor for Master Mode and Boot Devcie to Internal 32-bits.The out-the-door application uses MQX, but the Functional Board Tester code does not. Hence the MQX and Kernel references in the LCF. See attached linker file and partial .s19.

 

Since it appears the code wants to run out of External Flash, I changed the LCF to put all code in Extenal Flash. For good measure, I stuffed the appropriate SP and PC at the Reset Vector 0x00000000. This did not help. The code still does not boot up.

Also fixed the following assembly function by commenting out the first statement per Freescale AN4104. The VBR was not being initialized properly due to register_abi. However, this change did not get the code running in Flash either.

 

mcf5xxx_wr_vbr:

_mcfxxx_wr_vbr:

     // move.l 4(sp),d0

     movec d0,VBR

     nop

     rts


UPDATE: This problem is related to A5 Relative Addressing. My application code does not use it. But Standard C Libraries used in my application do use A5. __SDA_BASE is defined in the Linker File. errno cannot be saved since A5 has not been initialized. Documentation suggests that the linker will use this symbol to initialize A5. In my case, it is not. I can do the assignment myself in the startup code, but that does not seem to proper use of the linker. But what do you know, even initializing A5 in startup code does not resolve the bigger issue where

 

     sscanf(inText, "%lf", &inValue);

 

does not return. The system hangs.

 

Any suggestions?


Original Attachment has been moved to: SH_PHFT.Release.Flash---Copy.S19.zip

Original Attachment has been moved to: SH_flash_Lcf---Copy.lcf.txt.zip

Labels (1)
0 Kudos
3 Replies

496 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hello David,

Could you share your project with us? that way we can help you investigate on what is causing this issue.

Regards!

Carlos

0 Kudos

496 Views
david_brooks
Contributor II

Thanks Carlos, but how can I respond to you without publishing our code to the world?

0 Kudos

496 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hello David,

You can respond by going to Sales and Support|Freescale and click on Create service request, there you can attach your code so we can review it.

Regards!

Carlos Mendoza

0 Kudos