port example bare-metal source code to codewarrior project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

port example bare-metal source code to codewarrior project

1,747 Views
mbjvfx
Contributor II

Hi,

 

I am a beginner to the kinetis microcontroller and have gotten a few KL25Z dev boards to use in an upcoming project.  I plan on using codewarrior and have version 10.5 installed.  I have downloaded the quickstart guide and the sample code for the project.

 

In order to quickstart using the KL25Z for my projects I need to get started using  working with bare metal projects.  I would like to use existing project code from the basic projects source found in “KL25 Sample Code\kl25_sc_rev10\klxx-sc-baremetal\src\projects”  But, I am having problems getting the demo projects to properly build in CW10.5.

 

I am disappointed that there was not an already pre-built codewarrior project for the "demo"  projects that the board shipped with and the majority of the other projects for bare-metal.  I am not completely new to codewarrior/eclipse nor MCUs, but have spent numerous hours trying to build the project with no success.  I would think that this would be a direct problem other freedom board users and hope to get a decently documented set of instructions on creating the codewarrior project for  "FRDM_KL25ZDemo" the default running demo or any of the "demo" projects in the sample code download.

 

The only instructions that I can find are found in readme.txt at the root of "kl25_sc_rev10/readme.txt"  The instructions state:

Codewarrior Bare-metal projects

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

“The klxx-sc-baremetal\build\cw\make_new_cw_project.exe file can be used to clone the platinum project. The script will prompt you for a name to use for the new project, then creates copies of all needed compiler specific files and folders.  The main source file and klxx-sc-baremetal\src\cw\{proj name} files will need to be manually created.”


There seems to be a lot missing in the instructions to actually make this work.


1) What is the platinum project supposed to be?  A template project?  It appears that this project is a template with include paths to all of the dependent source in “klxx-sc-baremetal\src”.

2) The current source appears to have setup and interrupt code for IAR or other IDE’s than code warrior.  I can manage to get the code to build, but the interrupts are not setup correctly  and it jumps to the following interrupt handler which I believe is the default exception handler.


“void Default_Handler()

{

__asm("bkpt");

}


3)  So can someone provide instructions on how to actually re-create these “demo” projects in codewarrior?  Maybe I am overlooking something very obvious...


Note: It looks like this thread tried to address this same issue:  https://community.freescale.com/thread/307884 and has the “solution” of:

“see: FRDM_KL25ZSCG_CW.pdf found in “Kinetis L Sample Code\kl25_sc_rev6\klxx-sc-baremetal\build\cw” in the sample code directory.”

Too bad this pdf file no longer exists.


Labels (1)
0 Kudos
2 Replies

1,039 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello:

I think the case you mention about migrating example projects from IAR to CodeWarrior was not considered. Instead, the make_new_cw_project.exe can be used. You are correct, the platinum project is a template project. If you run the executable, you will have a project with the paths already set.

Now, from the folders in (klxx-sc-baremetal\src) 4 of them (common, cpu, drivers, platforms), only contain general or common code, such as module drivers, MCU/platform header files, etc, that can be used by any project that you create. These files do not change from one application to another.

But as the instructions mention, you need to have source files for your application, starting from "main.c". This file among with any other application specific files need to be added to the corresponding project folder in klxx-sc-baremetal\src\projects. Here you need to add a new folder for your project specific files (e.g. klxx-sc-baremetal\src\projects\my_project\) and in such folder you will add your project source files. In this case that you want to migrate one of the IAR examples, just copy the files from klxx-sc-baremetal\src\projects\FRDM_KL25ZDemo to klxx-sc-baremetal\src\projects\my_project). The necessary interrupt vectors are defined in the file isr.h, and that is why you are falling in the default interrupt handler, because the ISR are not defined by default.

Hope this explanation helps clafifying. Please do not hesitate to reply if you still have doubts.


Regards!
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,039 Views
mjbcswitzerland
Specialist V

Hi

Why not take a look at the uTasker project? : http://www.utasker.com/forum/index.php?topic=1721.0

It contains Kl and K support and takes a different approach. Instead of having a large number of demo projects for various device types and various IDEs, where there will always be missing combinations and is a huge task to maintain, it is a single project which will build with CW, IAR, Keil, Atollic, Rowley Crossworks or stand-along GCC. It will build on virtually all Freescale (and other) boards by setting just 4 project defines (the processor type, eg KL25, the board type, eg FRDM-KL25Z, whether it is an M4 or M0+ core and which linker script to use (mainly for the SRAM size and location needed by the linker).

It has its own Kinetis device and board simulator so once configured the simulator can be run to check that everthing has been set up correctly and then simply load to the HW with whichever compiler you prefer to work with. In case of difficulies it is intensively supported so users lose no time trying to unnecessarily work out problems on there own.

Regards

Mark

0 Kudos