_asm directive in KDS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

_asm directive in KDS

1,368件の閲覧回数
frankbannon
Contributor II

Hi everyone,

 

I am a noob with KDS and Kinetis MCU's.

I imported "hello world" examples for the FRDMKL26Z board and I am compiling.  I get a build error with the auto generated "Statup.c" code.  The complier is expecting an add'l "(" in the ASM directive, see below.

It appears that the statup.c code was imported from Keil and not specific to KDS and KDS doesn't like the syntax.  Any thoughts?

 

 

__asm void __thumb_startup(void)

 

{

 

  IMPORT __init_hardware

 

  IMPORT __main

 

  LDR R0, =__init_hardware

 

  BLX R0

 

  LDR R0, =__main

 

  BX R0

 

  ALIGN 4

 

}

 

ラベル(1)
タグ(2)
3 返答(返信)

1,171件の閲覧回数
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Frank,

the syntax is for ARM C compiler.

__asm void __thumb_startup(void)

{ <assembly code>}

  if use GNU C compiler, use this syntax, for example:

__asm (

        "mov    r0,%0\n\t"

        "cmp    r0,#0\n\t"

        "beq    skip_sp\n\t"

        "mov    sp,r0\n\t"

        "sub    sp,#4\n\t"

        "mov    r0,#0\n\t"

        "mvn    r0,r0\n\t"

        "str    r0,[sp,#0]\n\t"

        "add    sp,#4\n\t"

        "skip_sp:\n\t"

        ::"r"(addr));


Have a great day,
Zhang Jun

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,171件の閲覧回数
ivadorazinova
NXP Employee
NXP Employee

Hi Frank Bannon,


please, where you get the example Hello World for KL26Z?

Do you work with KSDK V1.1 ?


Best Regards,

Iva

0 件の賞賛
返信

1,171件の閲覧回数
frankbannon
Contributor II

Iva,

I am using KDS2.0

I got the example code from the FRDMKL26 sample code.  It is a CW project.

Frank

0 件の賞賛
返信