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
}
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!
-----------------------------------------------------------------------------------------------------------------------
Hi Frank Bannon,
please, where you get the example Hello World for KL26Z?
Do you work with KSDK V1.1 ?
Best Regards,
Iva
Iva,
I am using KDS2.0
I got the example code from the FRDMKL26 sample code. It is a CW project.
Frank