HCS12 Bootloader
来源:互联网 发布:学会编程可以做什么 编辑:程序博客网 时间:2024/06/06 21:41
近两天调试HCS12G128 程序异常跑飞,百思不得其解,最后找出元凶,堆栈溢出了。
S12G128 P-Flash reading issue in bootloader
- • 0
- 评论 • 4
Dears,
I'm working on S12G128 bootloader, it is based on AN4258.
Some certain chars have been written to P-Flash global address 0x2FE00, so after reset, bootloader will read address 0x2FE00 and decide how to go. A far pointer Upg_Cmd defined for this operation. See below code for more details.
#define Upg_Cmd_Addr 0x2FE00 //Global address 0x2FE00, store the chars
UINT8 * far Upg_Cmd;
#define GlobalToLocal(Address) (((Address) & 0x3FFFU) | (((Address) & 0x003FC000UL) << 2U) | 0x8000U)
UINT8 cc;
UINT8 const far upg_cmd_array[] @0x0BBE00 = "54600856"; //For debugging, test if bootloader can read these chars.
In main program, I'm using Upg_Cmd pointer to get the content in 0x2FE00 (Local paged address 0xBBE00) but always get 0xFF. I checked in BDM debugger interface and the actual content of 0x2FE00 (Local paged address 0xBBE00) is correct and not corrupted, also, Upg_Cmd can be correctly assigned 0xBBE00.
Upg_Cmd= (UINT8 * far) GlobalToLocal(Upg_Cmd_Addr);
cc= *Upg_Cmd++;
When code executed, cc is 0xFF which suppose to be '5'.
Any hints are apppreciated.
Walter
- HCS12 Bootloader
- HCS12加载RAM并执行Bootloader用户指南
- hcs12 microcontroller 笔记
- Bootloader
- BootLoader
- BootLoader
- BootLoader
- Bootloader
- bootLoader
- bootloader
- bootloader
- bootloader
- BootLoader
- Bootloader
- bootloader
- bootloader
- bootloader
- Bootloader
- tcp 的连接队列
- input 上传图片预览
- [入门案例] Express+MongoDB
- JAVA性能分析——JProfile
- Universal 2nd Factor (U2F) 概述(9)-客户端恶意软件与U2F设备的交互
- HCS12 Bootloader
- Java基础知识小计 一,依赖注入和控制反转
- Hybrid APP 混合开发模式的选择之路(四)
- IIS8 出现HTTP 500内部服务器错误解决方案
- Bootstrap table选取表格内元素
- mybatis中"#"和"$"的区别
- 编译,反编译,混淆,【二】
- Css常用效果总结 — 快速查询笔记
- All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tool
Hi,
see attached example project and read the main.c file:
//------------------------------------------------------------------------------
// for space creation see prm file. Search for keyword "NXP support"
// the cons is also added into entries and added feature "volatile" to be sure
// it is not revomed by optimization. You should check the address in debugger
// or S19 record to be sure the data is there
// Be sure you are using correct routine to get data from flash :
// press Alt F7-> Compiler for HCS12 -> Options -> Code generation ->
// -> Match PPAGE register is used for paging
// Write Runtime in the cell which appears.
// ..or write -CpPPAGE=RUNTIME into compiler option
// The compiler command line is also adjusted to be compiler informed we will
// use paged variables. The option "-D__FAR_DATA" is added into
// the compiler command line (Alt F7->Compiler for HC12 ->
// ->Add -D__FAR_DATA in the Command Line Arguments)
//------------------------------------------------------------------------------
..or write -CpPPAGE=RUNTIME into compiler option…
When debug you use see:
I hope this will lead you to solve your issue.
Best regards,
Ladislav