CMSIS Issue

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

CMSIS Issue

1,828 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tom Barrett on Fri Sep 12 05:06:25 MST 2014
When trying to use some of the "intrinsic" functions that deal with LPC122x registers such as __enable_irq or __get_MSP, I am running into a linker error that tells me, for example, 'undefined reference to `__get_MSP'. The result is the following error:

collect2.exe: error: ld returned 1 exit status
make: *** [Basic-Unit_Testing_SL.axf] Error 1

I have referenced a CMSIS project, CMSIS_CORE_LPC12xx, in the workspace and all code in the main project compiles without errors.

Can anyone point to what I am doing wrong wrt CMSIS that may be causing this error? Appreciate any help.
0 项奖励
回复
5 回复数

1,576 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by evilakki on Tue Dec 16 21:54:05 MST 2014
Hey Tom I am having similar problem with the macros. Can you please describe, which inherited code is interfering and how did you clean them up.
Thank you.
0 项奖励
回复

1,576 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tom Barrett on Fri Sep 12 12:26:16 MST 2014
Problem found. Some inherited code had defined some of the macros and the compiler did not report it as such. Cleaned them up and linkage completed as desired.

Many thanks for the help.
0 项奖励
回复

1,576 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Fri Sep 12 10:51:27 MST 2014
Post your actual code, or better still project that actually triggers the problem

http://www.lpcware.com/content/faq/lpcxpresso/how-importexport-projects

The following (linked to the CMSIS_CORE_LPC12xx library project from the LPCXpresso 7 examples) works fine here…

#include "LPC122x.h"

int main(void) {

    __enable_irq();

    // Force the counter to be placed into memory
    volatile static int i = 0 ;
    // Enter an infinite loop, just incrementing a counter
    while(1) {
        i++ ;
    }
    return 0 ;
}


Regards,
LPCXpresso Support
0 项奖励
回复

1,576 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tom Barrett on Fri Sep 12 10:28:25 MST 2014
Thanks, TheFallGuy, for the reply. I know they are macros and are defined in "core_cmFunc.h". But if I include that header file in main(), things get even worse with an error such as:

C:\Users\Tom\Documents\LPCXpresso_7.3.0_186\New_Workspace\CMSIS_CORE_LPC12xx\inc/core_cmFunc.h:340:52: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void)

Those errors appear for every one of the macro definitions on "core_cmFunc.h" whether or not the function is referenced in my source code.

I have also included the header file "system_LPC122x.h" but the error remains.

Any other tips? I do appreciate the help..
0 项奖励
回复

1,576 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Sep 12 05:55:35 MST 2014
It's a macro. So you need to use the cmsis core header file in the source files that use the macro.
0 项奖励
回复