主题中讨论的其他器件:UCD3138
工具/软件:Code Composer Studio
我想在 UCD3138的引导加载程序中获得准确的时间,但我找不到 standard_interrupt.c。
我添加了 standard_interrupt 的代码,但它始终有错误。
是否可以在 UCD3138的引导加载代码中添加"standard_interrupt"?
如何 配置?
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.
工具/软件:Code Composer Studio
我想在 UCD3138的引导加载程序中获得准确的时间,但我找不到 standard_interrupt.c。
我添加了 standard_interrupt 的代码,但它始终有错误。
是否可以在 UCD3138的引导加载代码中添加"standard_interrupt"?
如何 配置?
你好 Steven
地址0x18位于程序闪存开始处的矢量表中。 在我们的示例固件中、您应该有一个名为 load.asm (或可能是 load_ucd3138.asm)的文件。
请参阅下面的、其中有用于异常处理的矢量表。
.sect ".bvectors"
.state32.
b b_int00;addr - 0x0000
b vec_2;addr - 0x0004
b vec_3;addr - 0x0008
b vec_4;addr - 0x000C
b vec_5;addr - 0x0010
b vec_6;addr - 0x0014
b vec_7;addr - 0x0018
我们告诉编译器将此矢量表放置在".bvectors"段中(通过上面代码片段顶部的.sect ".bvectors")。
在链接器命令文件(cyclone.cmd)中、我们告诉链接器将此部分放置在程序闪存的开头、请参阅下面的。
存储器
{
BVECS:org = 0x00000000,len = 0x00000024
(笑声)
部分
{
.bvectors:{}> BVECS
当一个标准中断异常(IRQ)发生时、程序计数器应该分支到地址0x18、它是内核的一个特性。
在我们的示例中,当 IRQ 异常发生时,我们从地址0x18分支到标签"VEC_7"。 此标签包含在".pvectors7"部分中、请参阅下面 load.asm 中的内容。
.sect ".pvectors7"
.state32.
vec_7;B _standard_interrupt
我们通知链接器(通过链接器命令文件)将标签 VEC_7放置在应用程序的开头、请参阅下面链接器命令文件中的内容。
PVECS1:org = BFLASH_SIZE+0x00,len = 0x00000004
PVECS2:org = BFLASH_SIZE+0x04,len = 0x00000004
PVECS3:org = BFLASH_SIZE+0x08,len = 0x00000004
PVECS4:org = BFLASH_SIZE+0x0C,len = 0x00000004
PVECS5:org = BFLASH_SIZE+0x10,len = 0x00000004
PVECS6:org = BFLASH_SIZE+0x14,len = 0x00000004
PVECS7:org = BFLASH_SIZE+0x18,len = 0x00000004
PVECS8:org = BFLASH_SIZE+0x1C,len = 0x00000004
(笑声)
.pvectors1:{}> PVECS1
.pvectors2:{}> PVECS2.
.pvectors3:{}> PVECS3
.pvectors4:{}> PVECS4
.pvectors5:{}> PVECS5
.pvectors6:{}>PVECS6
.pvectors7:{}>PVECS7.
.pvectors8:{}>PVECS8
此处包含标签"VEC_7"的".pvectors7"段位于地址 BFLASH_SIZE + 0x18处。
因此、如果引导加载程序的长度为0x800字节(即、BFLASH_SIZE = 0x800)、我们将 VEC_7放置在地址0x800 + 0x18 = 0x818处。 在应用程序的 load.asm 文件中、地址为0x818、我们将有另一个分支指令、这次是实际的 IRQ 处理程序、它将位于包含应用程序的程序闪存部分。
总之、当应用程序运行时发生 IRQ 异常时、首先分支到地址0x18、然后分支到地址0x818、然后从此处分支到 IRQ 异常处理程序。
希望这有道理
此致
Cormac