9 years, 7 months ago.

Why mbed online result is different with keil MDK?

I have use mbed online make a kl05 test project. In my board I use internal oscillator, so I have not use default mbed library, then import mbed-src, and modified file "system_MKL05Z4.c", set macro CLOCK_SETUP from 1 to 0.

  1. define CLOCK_SETUP 0

And I use PTB6 and PTB7 to control two LEDs.

DigitalOut gpo(PTB7);

DigitalOut led(PTB6);

int main()

{

while (true) {

gpo = !gpo; toggle pin

led = !led; toggle led

wait(1.0f);

}

}

After I compile the project and donwload binary file to kl05z32vlc4, it works fine.

But when I export full project with Keil uVision4 Toolchain, and compile the project in keil MDK. Then I download binary file, I found it is not work now, and I also found binary file create by keil MDK, it is different with mbed online. I test project in MDK 5.11 and MDK 4.72, the result is same.

What is the problem?

My test project in:

http://mbed.org/users/shaoziyang/code/frdm_kl05z_gpio_test/

http://mbed.org/users/shaoziyang/code/mbed-src-kl05/

-----------------

I found that it must check "Use MicroLIB" option in Keil MDK project, if check this option, application will running, otherwise it is not run.

1 Answer

9 years, 7 months ago.

Hi,

so you answered your own question, the online compiler sets that flag for KL05Z (use MicroLib). More info about microlib http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0475c/BAJJIBHH.html

Therefore they did not match. Another difference, optimization is set to O3 in the online compilre, while exported projects by default have it set to O0.

Regards,
0xc0170

Accepted Answer

I also found that Freescale target file system_MKL05Z4.c, system_MKL05Z4.h in mbed is old. They are rev 1.3/1.6, but in Kinetis Design Studio, they are rev 1.7 now. When these files will be update?

posted by shao ziyang 15 Sep 2014

What are changes between those revisions? You can send a pull request on github mbed repository with updated header files.

posted by Martin Kojtal 15 Sep 2014