Why the primask not work when code from boot to mainApp?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Why the primask not work when code from boot to mainApp?

跳至解决方案
2,410 次查看
leimao
Contributor II

I writer a bootload, and I find when the code jump from boot to mainApp, it Fail. And I find I use PIT interupt in mainApp, So  I reset PIT interupt in mainApp when 

I jump to boot from App, It works ok.

But I realy do not understarand I shut down the primask, before I jump, It should close all interupt. Why the primask not work when code from boot to mainApp?

0 项奖励
回复
1 解答
2,166 次查看
leimao
Contributor II

Hi,hui

   Thanks your help.

   My question is ok. It is the start code enable primask.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
2,166 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

It caused by the interrupt and exception vectors. When your application with interrupt, it need to redirect the interrupt and exception vectors. The default interrupt and exception vectors are put into the starting address of the flash area used by the bootloader. When the boot jump to App, it need to redirect the App vector table, which should be in RAM. Customer could refer AN4368 chapter 5.2 about how to redirect interrupt and exception vectors.

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4368.pdf

Wish it helps.

0 项奖励
回复
2,166 次查看
leimao
Contributor II

hi, hui:

    Thanks for your help.

     My code whether in boot or in MainApp, it will do remap interrupt vectors in ram.The interrupt inveter works fine in boot and main.

     I think you misunderstand me. In boot, I donot use PIT. In MainApp, I do use PIT.

    My question is: I shut down primask in MainApp, the primask have power to shut down PIT interrupt. Why when the code from boot goto mainApp, it will get into boot's vector? It has no reasonable.

    By the way, the pdf show's code has a problem. It is not 0x400, will be 0x410

/* Copy the vector table to RAM */

if (___VECTOR_RAM != ___VECTOR_ROM)

{

for (n = 0; n < 0x400; n++)

___VECTOR_RAM[n] = ___VECTOR_ROM[n];

}

0 项奖励
回复
2,166 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi, Mao Lei,

Let me try to understand your question: you have a booltoader (boot) and an application (MainApp) in your code. And there is a primask, which will be call in the bootloader (boot). The primask aim is to disable the PIT interrupt or disable all interrupt. When call the primask in bootloader, then jumper to MainApp, you still could get PIT interrupt happen, the expected behavior is PIT interrupt could not happen. If my understand is correct?

If you are using below macro define to disable all interrupt in primask?

  /*!< Macro to enable all interrupts. */
#define EnableInterrupts asm(" CPSIE i");

  /*!< Macro to disable all interrupts. */
#define DisableInterrupts asm(" CPSID i");

Thanks.

0 项奖励
回复
2,167 次查看
leimao
Contributor II

Hi,hui

   Thanks your help.

   My question is ok. It is the start code enable primask.

0 项奖励
回复