MK22FN512 使用NXP_Kinetis_Bootloader_2_0_0 跳转APP有时不成功

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

MK22FN512 使用NXP_Kinetis_Bootloader_2_0_0 跳转APP有时不成功

1,982 Views
andypeng
Contributor I

MK22FN512 使用NXP_Kinetis_Bootloader_2_0_0的boot ,然后跳转到APP时,APP有时成功,有时失败。

NXP_Kinetis_Bootloader_2_0_0编译环境:Kinetis Design Studio Version: 3.2.0

NXP_Kinetis_Bootloader_2_0_0程序起始地址:0x0000,

MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
}

NXP_Kinetis_Bootloader_2_0_0的时钟我没有修改过。

 

app编译环境:Kinetis Design Studio Version: 3.2.0

APP的配置地址如下:

/* Entry Point */
ENTRY(__thumb_startup)

/* Highest address of the user mode stack */
_estack = 0x20010000; /* end of m_data */
__SP_INIT = _estack;
__stack = _estack;

/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x00; /* required amount of heap */
__stack_size = 0x0400; /* required amount of stack */

MEMORY {
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000198
m_text (RX) : ORIGIN = 0x0000A410, LENGTH = 0x00075BF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
m_cfmprotrom (RX) : ORIGIN = 0x0000A400, LENGTH = 0x00000010
}

APP使用的时钟模式为:PEE ,外部晶体为10MHz

NXP_Kinetis_Bootloader_2_0_0启动然后跳转到APP失败时,通过仿真器观察,出错在如下地址处(CPU_Init.c):

 

170315_170315.pngpastedImage_13.png

当APP的程序地址为0x0000时,如下配置时则没有上述的问题。

/* Entry Point */
ENTRY(__thumb_startup)

/* Highest address of the user mode stack */
_estack = 0x20010000; /* end of m_data */
__SP_INIT = _estack;
__stack = _estack;

/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x00; /* required amount of heap */
__stack_size = 0x0400; /* required amount of stack */

MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000198
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00075BF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}

附件是APP工程.

NXP_Kinetis_Bootloader_2_0_0的工程是官网下的。

170317_170317.pngpastedImage_1.png

170336_170336.pngpastedImage_2.png

 

 

请问这是什么原因?谢谢!

Original Attachment has been moved to: LED_DEMO.7z.zip

Labels (1)
0 Kudos
3 Replies

1,269 Views
andypeng
Contributor I

Hi Einfochips,

I want  using boot NXP_Kinetis_Bootloader_2_0_0 with MK22FN512 , and then jump to APP, APP sometimes successful, sometimes failure.
NXP_Kinetis_Bootloader_2_0_0 compiler environment: Kinetis Design Studio Version: 3.2.0 
NXP_Kinetis_Bootloader_2_0_0 program start address: 0x0000,

The following is the address configuration:

MEMORY
{
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
}

NXP_Kinetis_Bootloader_2_0_0 clock I have not modified.

APP compiler environment: Kinetis Design Studio Version: 3.2.0 

the following is the address configuration for APP:

/* Entry Point */
ENTRY(__thumb_startup)

/* Highest address of the user mode stack */
_estack = 0x20010000; /* end of m_data */
__SP_INIT = _estack;
__stack = _estack;

/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x00; /* required amount of heap */
__stack_size = 0x0400; /* required amount of stack */

MEMORY {
m_interrupts (RX) : ORIGIN = 0x0000A000, LENGTH = 0x00000198
m_text (RX) : ORIGIN = 0x0000A410, LENGTH = 0x00075BF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
m_cfmprotrom (RX) : ORIGIN = 0x0000A400, LENGTH = 0x00000010
}

APP uses the clock mode: PEE, the external crystal is 10MHz
From the NXP_Kinetis_Bootloader_2_0_0 start and then jump to the APP failed, through the emulator to observe, the error at the following address (CPU_Init.c):

pastedImage_1.png

When the APP program address is 0x0000, the following configuration does not have the above problem.

/* Entry Point */
ENTRY(__thumb_startup)

/* Highest address of the user mode stack */
_estack = 0x20010000; /* end of m_data */
__SP_INIT = _estack;
__stack = _estack;

/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x00; /* required amount of heap */
__stack_size = 0x0400; /* required amount of stack */

MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000198
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00075BF0
m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00020000
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}

The following is a APP clock configuration:

pastedImage_1.png

pastedImage_2.png

APP project on attachment .

How is the cause of this problem? 

Thanks & regards

Andy ,China

0 Kudos

1,269 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Andy,

Please follow the suggestion by colleague Fan Yang in your other post:

MK22FN512 NXP_Kinetis_Bootloader_2_0_0 jump to APP sometimes successful sometimes failure. 

Basically the fix is to add a delay after MCG_S[IREFST] is set to 1. This is because of silicon errata e7735. For a whole discussion about this issue you may have a look at the comments in the next document:

https://community.nxp.com/docs/DOC-256669 

Regards!

Jorge Gonzalez

0 Kudos

1,269 Views
harshpatel
Contributor IV

Hello  andypeng

Can you please describe again in english so we can understand your issue?

Thanks & regards

Harsh

Einfochips, INDIA

0 Kudos