K40 execute code from flash

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

K40 execute code from flash

跳至解决方案
3,703 次查看
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 解答
3,237 次查看
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 回复数
3,237 次查看
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 项奖励
回复
3,237 次查看
royw
Contributor II

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

 

:smileysad:

0 项奖励
回复
3,237 次查看
royw
Contributor II

Can nobody help me ? :smileysad:

0 项奖励
回复
3,237 次查看
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 项奖励
回复
3,237 次查看
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 项奖励
回复
3,237 次查看
royw
Contributor II

hmm,

 

can somebody try it on your own K40 tower ?

 

RW

0 项奖励
回复
3,237 次查看
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 项奖励
回复
3,237 次查看
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 项奖励
回复
3,237 次查看
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 项奖励
回复
3,237 次查看
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 项奖励
回复
3,238 次查看
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 项奖励
回复