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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
2,421件の閲覧回数
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,177件の閲覧回数
leimao
Contributor II

Hi,hui

   Thanks your help.

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

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,177件の閲覧回数
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,177件の閲覧回数
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,177件の閲覧回数
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,178件の閲覧回数
leimao
Contributor II

Hi,hui

   Thanks your help.

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

0 件の賞賛
返信