查看: 3979|回复: 2

[MQX] (求助)关于bootloader(FNET2.7.2)下载MQX应用程序

[复制链接]
  • TA的每日心情
    无聊
    2018-7-3 10:22
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    2

    主题

    18

    帖子

    0

    注册会员

    Rank: 2

    积分
    116
    最后登录
    2020-3-26
    发表于 2015-5-15 15:12:33 | 显示全部楼层 |阅读模式
    大家好:
    目前在做一个项目,是通过TFTP下载应用程序。我用的是FNET bootloader,这个开源项目支持tftp下载。
    开发环境是IAR7.2,TWR-K64F120M开发板。
    我用了两个应用程序做测试,其中KSDK中的hello_world已经能成功下载到flash并能正常运行,在串口中打印出Hello World! 但是用带MQX系统的hello工程就不能正常运行。
    根据 http://community.freescale.com/message/332455#332455这个帖子做完了相关配置:
    我修改后的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__ = 0x0000C000;
    /*-Memory Regions-*/
    define symbol __ICFEDIT_region_ROM_start__   = 0x0000C420 ;
    define symbol __ICFEDIT_region_ROM_end__     = 0x000FEFFF;

    define symbol __ICFEDIT_region_RAM_start__   = 0x1FFF0000;
    define symbol __ICFEDIT_region_RAM_end__     = 0x2002FFF0;
    /*-Sizes-*/
    define symbol __ICFEDIT_size_cstack__   = 0;
    define symbol __ICFEDIT_size_heap__     = 0;
    /**** End of ICF editor section. ###ICF###*/

    define exported symbol __EXTERNAL_MRAM_ROM_BASE = 0x60000000;
    define exported symbol __EXTERNAL_MRAM_ROM_SIZE = 0x00000000;
    define exported symbol __EXTERNAL_MRAM_RAM_BASE = 0x60000000;
    define exported symbol __EXTERNAL_MRAM_RAM_SIZE = 0x00080000;

    define exported symbol __EXTERNAL_LCD_BASE      = 0x60000000;
    define exported symbol __EXTERNAL_LCD_SIZE      = 0x1FFFF;
    define exported symbol __EXTERNAL_LCD_DC_BASE   = 0x60010000;
    define exported symbol __INTERNAL_FLASH_BASE    = 0x0000C000;
    define exported symbol __INTERNAL_FLASH_SIZE    = 0x000F2BE0;

    define exported symbol __INTERNAL_SRAM_BASE     = 0x1FFF0000;
    define exported symbol __INTERNAL_SRAM_SIZE     = 0x00040000;
    define exported symbol __SRAM_POOL              = 0x1FFF0000;

    define exported symbol __INTERNAL_FLEXNVM_BASE = 0;
    define exported symbol __INTERNAL_FLEXNVM_SIZE = 0;

    define exported symbol __VECTOR_TABLE_ROM_START = 0x0000C000;
    define exported symbol __VECTOR_TABLE_RAM_START = __ICFEDIT_region_RAM_start__;

    define exported symbol __DEFAULT_PROCESSOR_NUMBER = 1;
    define exported symbol __DEFAULT_INTERRUPT_STACK_SIZE = 1024;

    /* mem_init writes a storeblock_struct at the end of kernel data, max size 32 bytes, so use 0x100 offset */
    define exported symbol __BOOT_STACK_ADDRESS = __ICFEDIT_region_RAM_end__ - 0x100;


    define exported symbol __KERNEL_DATA_END = __ICFEDIT_region_RAM_end__;

    define memory mem with size = 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__   to __ICFEDIT_region_RAM_end__];

    define block KERNEL_DATA with alignment = 8 { section .kernel_data };

    define exported symbol __FLASHX_SECT_SIZE = 0x1000;
    define exported symbol __FLASHX_END_ADDR = __INTERNAL_FLASH_BASE + __INTERNAL_FLASH_SIZE;

    define block CFMPROTROM with size = 20 { section .cfmconfig };
    define block FLASHX_POOL with alignment = __FLASHX_SECT_SIZE { section .flashx };
    define block TEXTSECTION with alignment = 4 { section .text };
    keep { section .cfmconfig };
    keep { section .flashx };

    initialize by copy { readwrite };
    do not initialize  { section .noinit };
    do not initialize  { section .kernel_data };
    do not initialize  { section .flashx };

    place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec, block CFMPROTROM };
    place in ROM_region { first block TEXTSECTION, readonly,  last block FLASHX_POOL };

    place at address mem:__ICFEDIT_region_RAM_start__ { readwrite section .vectors_ram };

    /* each block/segment must be in one line (association to region) because I need kernel data start after other datas */
    place in RAM_region   { readwrite, last block KERNEL_DATA };

    在user_config.h文件中定义:
    #define MQX_ROM_VECTORS                           0
    重新编译MQX lib工程。再重新编译hello工程(应用程序)。

    修改IAR默认程序入口
    1.PNG

    通过bootloader下载后发送go命令,不能跳到应用程序执行。调试运行在go命令做了个断点,不带MQX系统(KSDK)工程直接在go命令后直接执行。带MQX系统的工程go命令后出现了个警告:Fri May 15, 2015 15:05:54: The stack pointer for stack 'CSTACK' (currently 0x1FFF0900) is outside the stack range (0x2002F000 to 0x20030000) 然后就停止运行了。
    什么超出堆栈范围。不知道是不是icf文件没配置好,因为帖子里是k60的,我用的是k64,有人用过嘛?

    这是飞思卡尔官方论坛中的类似帖子。
    http://community.freescale.com/message/332455#332455
    http://community.freescale.com/message/114116#114116



    我知道答案 目前已有2人回答
    该会员没有填写今日想说内容.
    回复

    使用道具 举报

  • TA的每日心情
    无聊
    2018-7-3 10:22
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    2

    主题

    18

    帖子

    0

    注册会员

    Rank: 2

    积分
    116
    最后登录
    2020-3-26
     楼主| 发表于 2015-5-18 11:36:14 | 显示全部楼层
    已经解决了,定义#define MQX_ROM_VECTORS 后要重新编译bsp psp 两个库工程。
    该会员没有填写今日想说内容.
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2018-7-2 06:04
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    59

    主题

    2888

    帖子

    10

    金牌会员

    Rank: 6Rank: 6

    积分
    6031
    最后登录
    2025-8-21
    发表于 2015-5-19 14:06:27 | 显示全部楼层
    非常感谢你关于MQX的经验分享 !
    该会员没有填写今日想说内容.
    回复 支持 反对

    使用道具 举报

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

    本版积分规则

    关闭

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

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

    GMT+8, 2025-9-12 17:56 , Processed in 0.092755 second(s), 24 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

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