Thanks for your attention!
Chip model: MPC5604CCL6, 100PIN, LQFP
Recently practiced using the nxp official website bootloader upgrade routine, modified from "Bolero_Bootloader_Ver2", used the serial port to upgrade, but encountered a problem:
The bootloader program can be run, and the upgraded app program can also run, but the information sent from the serial port after the app program starts is garbled, for example: main() in the app; the statement in the function is printf("system ready\r\n" ), is garbled, and if the data is sent from the PC serial port assistant to the MCU, and the MCU returns to the PC, it can be displayed normally; for example, “cmd00” is sent to the MCU through the serial port, and the serial assistant receives “cmd00”. Can be displayed normally.
The app program is stored at 0x0000A000 ~ 0x0007E000, and the area of B0F1~B0F6 has been erased before the program is programmed.
Thanks & regards.
Gathon
flash erase range:
CFLASH.LMS.R = 0x0003003E; // B0F1~B0F6
linker file memory range:
MEMORY
{
resetvector: org = 0x00000000, len = 0x00000008
APP_ENTRY: org = 0x00008000, len = 0x00000020
init: org = 0x00008020, len = 0x00000FE0
exception_handlers: org = 0x00009000, len = 0x00001000
internal_flash: org = 0x0000A000, len = 0x0007E000
internal_ram: org = 0x40000000, len = 0x00006000
heap : org = 0x40006000, len = 0x00001000
stack : org = 0x40007000, len = 0x00001000
}
已解决! 转到解答。
刚刚又测试了一下,解决了,但是,还是不知道其真正的原因,希望高人能帮忙详细讲解一下:
解决办法如下:
修改链接文件 “ MPC5604B_M27V.lcf ” 中 > internal_flash 的内容,也就是APP程序刷入的地址空间
/* ------------- the old content in linker file : ---------------*/
GROUP : {
.text_vle (VLECODE) LOAD (0xA000): {
*(.text)
*(.text_vle)
}
.text LOAD(_e_text_vle): {}
.rodata (CONST) LOAD(_e_text) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
/* ------------ Modified as follows -------------------- */
GROUP : {
.text : {}
.text_vle (VLECODE) ALIGN(0x08): { /* modified here as ALINGN(0x08) */
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
/* ------------------------------------------------------------ */
希望懂行的人能帮忙分析下,为什么0x08对齐之后,就没问题了,多谢!
刚刚又测试了一下,解决了,但是,还是不知道其真正的原因,希望高人能帮忙详细讲解一下:
解决办法如下:
修改链接文件 “ MPC5604B_M27V.lcf ” 中 > internal_flash 的内容,也就是APP程序刷入的地址空间
/* ------------- the old content in linker file : ---------------*/
GROUP : {
.text_vle (VLECODE) LOAD (0xA000): {
*(.text)
*(.text_vle)
}
.text LOAD(_e_text_vle): {}
.rodata (CONST) LOAD(_e_text) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
/* ------------ Modified as follows -------------------- */
GROUP : {
.text : {}
.text_vle (VLECODE) ALIGN(0x08): { /* modified here as ALINGN(0x08) */
*(.text)
*(.text_vle)
}
.rodata (CONST) : {
*(.rdata)
*(.rodata)
}
.ctors : {}
.dtors : {}
extab : {}
extabindex : {}
} > internal_flash
/* ------------------------------------------------------------ */
希望懂行的人能帮忙分析下,为什么0x08对齐之后,就没问题了,多谢!