通过仿真器下载BootLoader和APP程序之后,APP程序能正常运行(两路PWM输出,设置相同的占空比,两路PWM输出占空比相同),此时程序没有经过BootLoader,但是重启之后,程序由BootLoader跳转到APP之后,在测试APP程序,发现pwm输出不正确(发现两路PWM输出占空比不同),多次测试出现现象相同
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
通过仿真器下载BootLoader和APP程序之后,APP程序能正常运行(两路PWM输出,设置相同的占空比,两路PWM输出占空比相同),此时程序没有经过BootLoader,但是重启之后,程序由BootLoader跳转到APP之后,在测试APP程序,发现pwm输出不正确(发现两路PWM输出占空比不同),多次测试出现现象相同
BootLoader的CMD配置
MEMORY
{
PAGE 0: /* Program Memory */
RAML00 : origin = 0x008000, length = 0x000100 /* on-chip RAM block L2 */
OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */
BOOT_CODE : origin = 0x3F4000, length = 0x003F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL_P0 : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */
IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */
PAGE 1 : /* Data Memory */ */
BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block L2 */
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > BOOT_CODE PAGE = 0 /* 初始化的全局变量和static变量表*/
.pinit : > BOOT_CODE, PAGE = 0 /* 全局对象的构造函数表 C++范畴*/
.text : > BOOT_CODE PAGE = 0 /* 可执行代码和常数段 */
codestart : > BEGIN PAGE = 0 /* 代码启动段 */
// Flash28_API:
// {
// -l Flash2803x_API_V100.lib(.econst)
// -l Flash2803x_API_V100.lib(.text)
// } LOAD = BOOT_CODE,
// RUN = RAML0,
// LOAD_START(_Flash28_API_LoadStart),
// LOAD_END(_Flash28_API_LoadEnd),
// RUN_START(_Flash28_API_RunStart),
// PAGE = 0
ramfuncs : LOAD = BOOT_CODE, /* 将定义到段ramfuncs上的代码,载入到BOOT_CODE */
RUN = RAML00, /* 定义到ramfuncs上的代码,复制到RAML0上运行 */
LOAD_START(_RamfuncsLoadStart), /* 所要加载程序在Flash里的初始地址 */
LOAD_END(_RamfuncsLoadEnd), /* 所要加载程序在Flash里的结束地址 */
RUN_START(_RamfuncsRunStart), /* 程序运行的起始地址 */
PAGE = 0
csmpasswds : > CSM_PWL_P0 PAGE = 0 /* 密码段 */
csm_rsvd : > CSM_RSVD PAGE = 0 /* 使用代码安全模块时,需要预留的段 */
/* Allocate uninitalized data sections: 未初始化数据段 */
.stack : > RAMM0 PAGE = 1 /* 栈空间*/
.ebss : > RAMM1 PAGE = 1 /* 长调用的全局或static变量,初始化和未初始化变量*/
.esysmem : > RAMM0 PAGE = 1
/* Initalized sections go in Flash 已初始化的段*/
.econst : > BOOT_CODE PAGE = 0 /* 字符串常量和far const定义的全局和静态变量(static const)*/
.switch : > BOOT_CODE PAGE = 0 /* 存放switch语句产生的常数表格*/
/* Allocate IQ math areas: 分配 IQ 数学表区域 */
IQmath : > BOOT_CODE PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
}
APP的CMD配置
_Cla1Prog_Start = _Cla1funcsRunStart;
-heap 0x200
-stack 0x400
CLA_SCRATCHPAD_SIZE = 0x100;
--undef_sym=__cla_scratchpad_end
--undef_sym=__cla_scratchpad_start
MEMORY
{
PAGE 0: /* Program Memory */
RAML00 : origin = 0x008000, length = 0x000100 /* on-chip RAM block L0 */
RAML2 : origin = 0x008C00, length = 0x000400 /* on-chip RAM block L2 */
RAML3 : origin = 0x009000, length = 0x000400 /* on-chip RAM block L3 */
OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */
APP_INFO_ADDR :origin = 0x3EE000, length = 0x000006
APP_BEGIN : origin = 0x3EE006, length = 0x000002
APP_CODE : origin = 0x3EE200, length = 0x005E00
IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */
IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */
PAGE 1 : /* Data Memory */
BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0007B0 /* on-chip RAM block M0 */
RAML01 : origin = 0x008100, length = 0x000700 /* on-chip RAM block L0 */
CLA_DATA : origin = 0x3EE008, length = 0x0001F8
CLARAM0 : origin = 0x008800, length = 0x000400
CLARAM1 : origin = 0x009800, length = 0x000400
CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080
CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080
}
SECTIONS
{
/* Allocate program areas: */
.cinit : > APP_CODE PAGE = 0
.pinit : > APP_CODE, PAGE = 0
.text : > APP_CODE PAGE = 0
codestart : > APP_BEGIN PAGE = 0
ramfuncs : LOAD = APP_CODE,
RUN = RAML2,
LOAD_START(_RamfuncsLoadStart),
LOAD_SIZE(_RamfuncsLoadSize),
RUN_START(_RamfuncsRunStart),
PAGE = 0
/* Allocate uninitalized data sections: */
.stack : > RAMM0 PAGE = 1
.ebss : > RAML01 PAGE = 1
.esysmem : > RAMM0 PAGE = 1
/* Initalized sections go in Flash */
.econst : > APP_CODE PAGE = 0
.switch : > APP_CODE PAGE = 0
InfoData : > APP_INFO_ADDR PAGE = 0
/* Allocate IQ math areas: */
IQmath : > APP_CODE PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
.bss_cla : > CLARAM0, PAGE = 1
.scratchpad : > CLARAM0, PAGE = 1
Cla1Prog : LOAD = APP_CODE,
RUN = RAML3,
LOAD_START(_Cla1funcsLoadStart),
LOAD_END(_Cla1funcsLoadEnd),
RUN_START(_Cla1funcsRunStart),
LOAD_SIZE(_Cla1funcsLoadSize),
PAGE = 0
Cla1ToCpuMsgRAM : > CLA1_MSGRAMLOW, PAGE = 1
CpuToCla1MsgRAM : > CLA1_MSGRAMHIGH, PAGE = 1
Cla1DataRam0 : > CLARAM0, PAGE = 1
Cla1DataRam1 : > CLARAM1, PAGE = 1
GROUP : LOAD = CLA_DATA,
RUN = CLARAM1,
LOAD_START(_Cla1mathTablesLoadStart),
LOAD_END(_Cla1mathTablesLoadEnd),
RUN_START(_Cla1mathTablesRunStart),
LOAD_SIZE(_Cla1mathTablesLoadSize),
PAGE = 1
{
CLA1mathTables
.const_cla
}
CLAscratch :
{ *.obj(CLAscratch)
. += CLA_SCRATCHPAD_SIZE;
*.obj(CLAscratch_end) } > CLARAM0,
PAGE = 1
/* DSECT */
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT
}发现pwm输出不正确(发现两路PWM输出占空比不同)
能不能上传一下PWM的波形?占空比不同会相差多少?相差的值固定吗?
这个是正确的波形,直接从BootLoader程序跳转到app
你之前说的是不经过bootloader时波形是正常的,而从bootloader跳到APP的时候波形是不正常的。这里再确认一下;
这是错误的波形,右边是启动时的EPWM1、EPWM2、EPWM3、EPWM4寄存器的变化情况
示波器上的波形对应的分别是哪两路信号?