Creating MQX 4.0 BSP for K10

显示  仅  | 搜索替代 

Creating MQX 4.0 BSP for K10

Creating MQX 4.0 BSP for K10

Sharing notes taken during creation of MQX 4.0 K10 BSP.

These particular notes are for 72 MHz version of K10 (part number K10DX128VLL7), so the baseline BSP for this is twrk20d72m, tested with CodeWarrior IDE. (I believe analogous steps could be taken for other K10 versions as well, just need to select appropriate baseline BSP.)

For the K10 BSP, we need to remove USB related code (as there is no USB module on K10) and add #elif into some *mk20.c files such as adc_mk20.c and spi_mk20.c.

     1. Add a new unique CPU ID into c:\Freescale\Freescale_MQX_4_0\mqx\source\psp\cortex_m\psp_cpudef.h. For example:


     2. Copy processor header file MK10D7.h from c:\Freescale\CW MCU v10.3\MCU\ProcessorExpert\lib\Kinetis\iofiles\MK10D7.h to c:\Freescale\Freescale_MQX_4_0\mqx\source\psp\cortex_m\cpu\mk10d7.h

     3. In the header file: c:\Freescale\Freescale_MQX_4_0\mqx\source\psp\cortex_m\kinetis.h add #include "MK10D7.h" for your processor. For example:

#elif   (MQX_CPU == PSP_CPU_MK10DX128)

   #include "MK10D7.h"

     4. Use BSP clone tool to clone baseline BSP (twrk20d72m) into a new BSP with a new name such as "board_k10d72m".

     5. In user_config.h of the new BSP, c:\Freescale\Freescale_MQX_4_0\config\board_k10d72m\user_config.h change MQX_CPU as it follows:

#define MQX_CPU                 PSP_CPU_MK10DX128

     6. PSP builds OK. From BSP, we need to remove USB related code in init_gpio.c comment lines 609 and 612 c:\Freescale\Freescale_MQX_4_0\mqx\source\bsp\board_k10d72m\init_gpio.c:



     7. In CW IDE, remove USB source code from "bsp_board_k10d72m" build project under "Peripheral IO Drivers".

Remove complete "usb" virtual folder from the BSP build project. Remove "init_usb.c" from "board_k10d72m BSP Files"

     8. In BSP source file "spi_mk20.c" c:\Freescale\Freescale_MQX_4_0\mqx\source\io\spi\spi_mk20.c add #elif for k10:

#elif (MQX_CPU == PSP_CPU_MK10DX128)

static const pointer dspi_address[] =





static const uint_32 /*PSP_INTERRUPT_TABLE_INDEX*/ dspi_vectors[][1] =


   { INT_SPI0 },

   { INT_SPI1 },


     9. Similar change need to adc_mk20.c c:\Freescale\Freescale_MQX_4_0\mqx\source\io\adc\kadc\adc_mk20.c:

#elif (MQX_CPU == PSP_CPU_MK10DX128)

static const pointer adc_address[] = {




     10. BSP project builds OK. Smiley Happy

     11. MFS, RTCS, SHELL projects build OK. Smiley Happy

     12. If you wish to build an MQX application with this new BSP, don't forget to change the paths to MQX libs and include files in your application project:

C compiler "-i" option:

  (for Debug build configuration)








Linker additional libraries:

  psp.a, bsp.a, mfs.a, rtcs.a, shell.a

Linker Library search paths:






Path to linker command file:



Thanks for the post but for MQX 4.1 I had to do some things more to make it work:

1-) in step 6 has to be removed all the code of _bsp_usb_io_init not only the two lines commented

2-) two more files have to be edited, because they have the #if (MQX_CPU == PSP_CPU_MK20DX256) old CPU definition, Search for that tag end edit according to the indications above.

For :     i2c_mk20.c

#elif (MQX_CPU == PSP_CPU_MK10DX64)

      case 1:

         addr = (void *) I2C1_BASE_PTR;



For:     serl_mk20.c

#elif (MQX_CPU == PSP_CPU_MK10DX64)

   case 3:

      addr = (void *)UART3_BASE_PTR;


3-) In step 8 (pointer) needs to be changed by (void *)

Best regards


‎09-10-2020 02:20 AM