_start problem with KL05Z

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

_start problem with KL05Z

Jump to solution
913 Views
Ardoster
Contributor III

Hi

 

I'm starting up with the KL05Z and Kinetis Design Studio, but I'm having problems when my code arrives to _start. To put you in context, I've operated as follows:

 

1 - I've created a new Kinetis Design Studio: NEW_PROJECT -> KINETIS DESIGN STUDIO.

2 - Selected in the processor list the MKL05Z32xxx4

3 - I don't select the options Kinetis SDK (not available), neither the Processor Expert tick. I want a bare metal project.

4 - Click Finish

 

The generated project compiles correctly, but has the problem that when arrives to _start hangs. I've replaced the _start function by main, and now the application runs correctly, but I think there's a problem with static and global variables, because they are not being initialized. It must be a problem with startup files.

 

How can I fix it?

 

Thanks you in advance

 

Regards,

Eduardo

Labels (1)
0 Kudos
1 Solution
572 Views
BlackNight
NXP Employee
NXP Employee

Hi Eduardo,

can you check you linker file, if you have this:

/* Entry Point */

ENTRY(Reset_Handler)

HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x00000200;

STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000100;

/* Specify the memory areas */

MEMORY

{

  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000100

  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010

  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x00007BF0

  m_data                (RW)  : ORIGIN = 0x1FFFFC00, LENGTH = 0x00001000

}

Erich

View solution in original post

0 Kudos
3 Replies
573 Views
BlackNight
NXP Employee
NXP Employee

Hi Eduardo,

can you check you linker file, if you have this:

/* Entry Point */

ENTRY(Reset_Handler)

HEAP_SIZE  = DEFINED(__heap_size__)  ? __heap_size__  : 0x00000200;

STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000100;

/* Specify the memory areas */

MEMORY

{

  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000100

  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010

  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x00007BF0

  m_data                (RW)  : ORIGIN = 0x1FFFFC00, LENGTH = 0x00001000

}

Erich

0 Kudos
573 Views
Ardoster
Contributor III

Hi

Thanks you!!!!! The problem was in the HEAP_SIZE. The generated linker file configured this value to 100, instead 200 as yours. Correcting this value, the _start function is called now correctly.

Thanks again!!!!

Regards,

Eduardo

0 Kudos
573 Views
BlackNight
NXP Employee
NXP Employee

You are welcome :-)

It is that problem that the GNU libraries in KDS require an excessive amount of heap memory. This problem does not exist for the ARM Embedded Lauchpad tools (that's why I'm using launchpad in many of my projects, see Switching ARM GNU Tool Chain and Libraries in Kinetis Design Studio | MCU on Eclipse).

Erich

0 Kudos