查看: 6209|回复: 1

[已解决] K60 IAR环境下bootloader求助(已解决)

[复制链接]

该用户从未签到

1

主题

6

帖子

0

新手上路

Rank: 1

积分
29
最后登录
1970-1-1
发表于 2013-8-24 16:37:30 | 显示全部楼层 |阅读模式
我自己写了一个bootloader,用串口从上位机把BIN文件到K60内。bootloader和应用
程序的开发环境都是IAR.我把0X00000--0X7fff定义为BOOTLOADER空间,总共32K,其它
空间定义为应用程序空间,现在BOOTLOADER程序和应用程序都写好了,但应用程序通过
BOOTLOADER程序下进去后,不能运行没有任何反应,不知什么原因!
 
 
应用程序ICF为
 
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00008000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00008000;
define symbol __ICFEDIT_region_ROM_end__   = 0x00040000;                    //0x00040000-flashk 256k  D-flash 256k   0x00080000-flashk 512k
define symbol __ICFEDIT_region_RAM_start__ = 0x1ffff400;                    //前面的0x410 RAM留给 RAM User Vector Table 。 
define symbol __ICFEDIT_region_RAM_end__   = 0x20000000;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x2000;
define symbol __ICFEDIT_size_heap__   = 0x2000;
/**** End of ICF editor section. ###ICF###*/
 
 
/**** 上边是由ICF编辑,下面是由我们手动配置 ****/
 
define symbol __region_RAM2_start__ = 0x20000000; //SRAM 是分成两块的,RAM2即SRAM_U ,RAM 为 SRAM_L
define symbol __region_RAM2_end__ = 0x20000000 + __ICFEDIT_region_RAM_end__ - __ICFEDIT_region_RAM_start__;
 
define exported symbol __VECTOR_TABLE = __ICFEDIT_intvec_start__; //代码编译进 ROM ,则 0x00000000 ;RAM,则 __ICFEDIT_region_RAM_start__
define exported symbol __VECTOR_RAM = __ICFEDIT_region_RAM_start__;  //前面的RAM留给 RAM User Vector Table,即这里的设置。所以减 0x410
//common_startup函数就是把 __VECTOR_TABLE 的数据复制到  __VECTOR_RAM
 
define exported symbol __BOOT_STACK_ADDRESS = __region_RAM2_end__ - 8; //0x2000FFF8;       //启动栈地址
 
/* 决定代码编译的地址 */
define exported symbol __code_start__ = __ICFEDIT_intvec_start__ + 0x410; //代码编译进 ROM ,则  __ICFEDIT_region_ROM_start__ + 0x410 , RAM,则   __ICFEDIT_region_RAM_start__  + 0x410
                                      //+0x410 ,是前面的留给 Vector Table 
 
define memory mem with size = 4G; //4G的虚拟寻址空间
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__ + 0x410   to __ICFEDIT_region_RAM_end__] | mem:[from __region_RAM2_start__ to __region_RAM2_end__];
 
define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { }; //堆
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { }; //栈
 
 
//手动初始化,在 common_startup函数 里完成
initialize manually { readwrite };   // 未初始化数据 .bss
initialize manually { section .data};      // 已初始化数据
initialize manually { section .textrw };   // __ramfunc声明的子函数
 
do not initialize  { section .noinit };    // 复位中断向量服务函数
 
 
define block CodeRelocate { section .textrw_init };
define block CodeRelocateRam { section .textrw };         // CodeRelocateRam  把代码复制到RAM中(对flash操作的函数必须这样)
 
 
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };//vectors.c 中设置 #pragma location = ".intvec"   ,告诉编译器,这个是中断向量表,编译进去 .intvec
place at address mem:__code_start__ { readonly section .noinit }; //在crt0.s 中设置了 SECTION .noinit : CODE  ,即把代码编辑进去 .noinit
 
place in ROM_region   { readonly, block CodeRelocate }; //把代码编译进去 ROM (调试用) ,非调试,则设为 ROM_region
 
place in RAM_region   { readwrite, block CodeRelocateRam,
                        block CSTACK, block HEAP };   
 
bootload程序包
bootload.zip (2.22 MB, 下载次数: 156)
回复

使用道具 举报

该用户从未签到

85

主题

790

帖子

0

金牌会员

Rank: 6Rank: 6

积分
2279
最后登录
1970-1-1
发表于 2013-8-29 14:31:03 | 显示全部楼层

RE:K60 IAR环境下bootloader求助(正解)

飞思卡尔有一个应用笔记AN2295,这个笔记是关于串口的bootloader的。请参考这个应用笔记。链接是http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2295.pdf?fsrch=1&sr=22
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-20 15:36 , Processed in 0.089426 second(s), 23 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表