K40 execute code from flash

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

K40 execute code from flash

ソリューションへジャンプ
2,330件の閲覧回数
royw
Contributor II

Hi,

I am new on Kinetis and IAR .

Now I wrote a liitle program with IAR EWB 6.3 for my Kinetis K40 Tower.

I can execute my progam by debugging with my JLink debugger, but when I will start my program after a Power off -> on, the program will not start.

I have already tried many ICF files but none file works.

What is wrong in my source ?

I have attached my project. May be someone can help.

Thanks in advance ..

RW

 

0 件の賞賛
返信
1 解決策
1,864件の閲覧回数
royw
Contributor II

I found my mistake .

 

now I can run my program from flash.

It was a wrong setting in the project options  ...

 

under General options / library Configuration -> stdout/stderr must be set to "Via SWO" .

 

Thanks for all they want help

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
11 返答(返信)
1,864件の閲覧回数
evgenik
Contributor IV

Hi.

 

I had the same problem. I added wait() for 0.25 second after MCU initialization and before all peripheries initialization. The time that you need for delay you can try by yourself.

 

Evgeni.

R&D Engineer

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

Thanks for your fast reply, but that was not the reason ...

 

:smileysad:

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

Can nobody help me ? :smileysad:

0 件の賞賛
返信
1,864件の閲覧回数
mjbcswitzerland
Specialist V

Hi

 

See pages 30/31 of the following http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis_demo.pdf "Reset and Watchdog"

Maybe that will explain a possible difficulty.

 

Regards

 

Mark

 

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

Hi,

 

in debugging mode all works fine, but it does not work when I will start the firmware without debugger.

 

RW 

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

hmm,

 

can somebody try it on your own K40 tower ?

 

RW

0 件の賞賛
返信
1,864件の閲覧回数
c0170
Senior Contributor III

Hi royw,

 

i run your example,  your project does not have correctly set up the start up code. It should start with crt0.s and jump to the start().

 

If you check start function, first step is to disable wdog then call sysinit. Your problem was to disable wdog : wdog_disable();

 

Then it runs even after power reset.

 

Regards,

MartinK

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

Hi Martin,

 

I don't understand what you mean.

In my project is the "crt0.s" implemented and the start() function call the wdog_disable();  as first. (start.c) .

 

I can set a breakpoint to this line ind start() and the debugger stopp at this line.

0 件の賞賛
返信
1,864件の閲覧回数
c0170
Senior Contributor III

why do you call function sysinit from main function?

 

I downloaded your project and I set breakpoint to the startup code. it did not jump there . Therefore quickly i called wdog_disable() and sysinit() from main. then everything worked after power on reset.

 

0 件の賞賛
返信
1,864件の閲覧回数
royw
Contributor II

I have made a smaller project with blinking LEDs.

(.zip file attached)

 

Can somebody test it on your own K40-tower.

 

With JLinks debugger I can Start and debug this project.

But it don't start from self after Power on ...

 

Thanks for your help

0 件の賞賛
返信
1,865件の閲覧回数
royw
Contributor II

I found my mistake .

 

now I can run my program from flash.

It was a wrong setting in the project options  ...

 

under General options / library Configuration -> stdout/stderr must be set to "Via SWO" .

 

Thanks for all they want help

 

 

0 件の賞賛
返信