The code is correct but can not run on LPCXpresso, but it can run on Keil.

cancel
Showing results for 
Search instead for 
Did you mean: 

The code is correct but can not run on LPCXpresso, but it can run on Keil.

Jump to solution
445 Views
litater
Contributor II

I want to test the following code.

微信截图_20170510093919.png

微信截图_20170510094030.png

It will be fail.hang on this line.

微信截图_20170510094123.png

but if this code run in keil,it will be ok.

微信截图_20170510094343.png

all the code are same.Including clock configuration, no other peripheral functions.and compare all the register are same.

Keil Version.

微信截图_20170510094440.png

LPCXpresso IDE Version.

微信截图_20170510094508.png

Debugger.

微信截图_20170510094608.png

What can i do for next.

Labels (1)
Tags (1)
0 Kudos
1 Solution
115 Views
litater
Contributor II

Very good, I found where the BUG.   

Complier!!!!!!!!!

微信截图_20170511145557.png

-O3 at LPCXpresso are fail,-O2,-Os at LPCXpresso are partial failure,-O1,-O0,-Og can be ok.

The debug level does not affect the results.

but at keil,all Optimization level are ok.

You may be able to test my code.

lpcxpresso_support

View solution in original post

0 Kudos
6 Replies
115 Views
lpcxpresso_supp
NXP Employee
NXP Employee

This probably is not a tools issues as such.As I said previously, check the initialisation code that sets up the memory interface. I assume there is some difference between this code in your LPCXpresso and Keil projects.

Regards,

LPCXpresso Support

0 Kudos
116 Views
litater
Contributor II

Very good, I found where the BUG.   

Complier!!!!!!!!!

微信截图_20170511145557.png

-O3 at LPCXpresso are fail,-O2,-Os at LPCXpresso are partial failure,-O1,-O0,-Og can be ok.

The debug level does not affect the results.

but at keil,all Optimization level are ok.

You may be able to test my code.

lpcxpresso_support

View solution in original post

0 Kudos
115 Views
litater
Contributor II

there are two project.

0 Kudos
115 Views
litater
Contributor II

cr_startup_lpc177x_8x.c & sysinit.c are differnet,but keil does not have this,SystemInit function are the same,and the same code in main.c now,but problem does not slove.

In Keil:

Reset_Handler(raminit by keil code,no source) -> SystemInit -> main

In LPCXpresso:

ResetISR(raminit)->SystemInit(the same as keil)->__main (no source) ->main

In fact, I am compared to the contents of each line, I have compared the value of the register affected.

0 Kudos
115 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Given where you say your debug session is hanging, my best guess would be that there is a problem with the code that you are using to set up the external memory interface to the NOR flash.

Regards,

LPCXpresso Support

0 Kudos
115 Views
litater
Contributor II

at this line,LPCXpresso always read out 0xFFFF,but i don't know what the happen.

 while (*(volatile uint16_t *)(0x80000000 | (Addr<<1)) != Data);

but the same code in keil works well.

0 Kudos