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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,189 次查看
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.

标签 (1)
标记 (1)
0 项奖励
1 解答
859 次查看
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

在原帖中查看解决方案

0 项奖励
6 回复数
859 次查看
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 项奖励
860 次查看
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

0 项奖励
859 次查看
litater
Contributor II

there are two project.

0 项奖励
859 次查看
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 项奖励
859 次查看
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 项奖励
859 次查看
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 项奖励