CSMG Sarma

Freescale K64 Based Custom Board Bringup

Blog Post created by CSMG Sarma on Sep 7, 2018

When you start a board bring up activity from scratch, there are many challenges. The first of these challenges is the choice of the development environment. Is there any commercial agreement with an IDE Vendor? How flexible is debugging on the IDE and build time, code footprint after optimization etc are related concerns. If the choice is a command line based build environment, the developer is free to choose what features he needs and how easily he can customize it for his requirements.

 

In case of a Graphical development environment, the IDE takes that decision for you. There are many Graphical IDEs some are commercially licensed and some are available with opensource licenses. Eclipse based IDEs are very famous across the opensource licensed Graphical IDEs.

 

Not just due to its extended support, flexibility and ease of use, but also because eclipse provides SDKs to auto generate code for quick application development, many semiconductor vendors(like NXP and Infineon) are giving eclipse based IDEs While I have worked with both commercial and opensource IDEs, my personal favorite has always been an eclipse based IDE. The following are some of the cool eclipse based tools that I have worked with:

  1. Infineon's DAVE is an eclipse based IDE which auto generates MISRA C compliant c code for low level drivers which are run on bare metal as well as on an RTOS for Infineon's micro controllers. Reference.
  2. Freescale's Processor expert is an eclipse plugin which generates C code for Freescale's microcontrollers for baremetal or RTOS(MQX, FreeRTOS, uCOSII) applications. Reference

 

 

The code generated here can be compiled with GCC(default), IAR or Tasking compilers.These are some reasons which make opensource Eclipse tools my favorite. Besides these, I always prefer my IDE to have the following features:

  1. Documentation extraction or generation from source code.
  2. Auto indentation,
  3. Auto complete option for variables, API, pre processor includes, etc.
  4. Performance analysis like code coverage
  5. Subversion control,
  6. Compare and Merge options for code references.

 

Eclipse based IDEs provide very easy interface or plugins for these features. Having said that, the custom board I had to bring up is Freescale MK64FX512 based microcontroller to run applications based on Freescale MQX 4.2 RTOS. MQX has a clearly defined structure as given in the following references:

Video Vault

Getting Started with MQX.

 

Briefly, to bring up the board with MQX RTOS:

  1. Identify the reference base board.
  2. If the base board configuration matches with your board hardware, go as is otherwise, customize the PSP(Processor Support Package) and BSP(Board Support Package) for your board and rebuild the PSP and BSP projects. The output is a library file for both these projects.
  3. Integrate the bsp.lib and psp.lib with the hello_world project given by MQX for all supported packages and configurations. While you can prepare a hello world project from scratch, picking up an existing project is easier and time saving.

I'll make a separate note on how to customize the BSP and PSP projects for custom hardware. This note is intended to describe the steps involved in the board bring up and customizing the development environment.

 

Here are the steps to bringup a Freescale K64 micro based custom board on MQX RTOS for KDS IDE. My base board is TWR-K64. Yours can be a FRDM-K64 too which is very popular these days. I have taken the hello_world project in the example projects list for the bring up activity.

Add the following paths in the compiler-> include settings in settings page: "${workspace_loc:/${ProjName}/Includes/debug}"

"${workspace_loc:/${ProjName}/Includes/debug/bsp}"

"${workspace_loc:/${ProjName}/Includes/debug/psp}"

"${workspace_loc:/${ProjName}/Includes/debug/bsp/Generated_Code}"

"${eclipse_home}../toolchain/lib/gcc/arm-none-eabi/4.8.4/include"

"${eclipse_home}../toolchain/lib/gcc/arm-none-eabi/4.8.4/include-fixed"

"${eclipse_home}../toolchain/arm-none-eabi/include"

 

If you have any custom code or drivers or application codes, add their paths as follows: "${workspace_loc:/${ProjName}/}"

 

You can ensure that the firmware project is portable in this way as it avoids absolute links. Try to keep all all links relative to the work space or project location. Add the custom BSP and PSP libraries to Linker->Miscellaneous-> Other Objects as follows:

"${workspace_loc:/${ProjName}//bsp.a}"

"${workspace_loc:/${ProjName}//psp.a}"

 

Custom linker script can be added in Linker->General->Script Files as follows: "${workspace_loc:/${ProjName}//custom_linker_script.ld}"

 

Now build your application, clear the compiler issues and you are ready to go! Besides this, you can also add the Doxygen, Emsys register View plugins for documentation and debugging. Visit  this reference for more details on this.

 

Happy coding!

Outcomes