_asm directive in KDS

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

_asm directive in KDS

587 Views
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

 

}

 

Labels (1)
Tags (2)
3 Replies

390 Views
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!
-----------------------------------------------------------------------------------------------------------------------

390 Views
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 Kudos

390 Views
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 Kudos