K10 Support for MQX?

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

K10 Support for MQX?

Jump to solution
2,933 Views
lowks
Contributor III

Hi,

 

I know there are two BSP for K40 and K60. However, if I wish to use K10, what should I do? Will there be a BSP provided or I need to create my own BSP?

0 Kudos
1 Solution
1,364 Views
anthony_huereca
NXP Employee
NXP Employee

No, the PSP would remain the same. All changes would be in the \config folder and the \bsp folder.

View solution in original post

0 Kudos
14 Replies
1,364 Views
anthony_huereca
NXP Employee
NXP Employee

You will need to create your own BSP. There is an app note on this process that will be released in a week or so detailing the steps to copy the folders and modify the project settings. 

 

Until then, you can try modifying the K60 BSP to run on your K10 board. All the relevant code changes are in the <mqx_dir>\mqx\source\bsp\twrk60n512\ folder, with most of the changes taking place in the twrk60n512.h, init_hw.c and init_gpio.c files.

0 Kudos
1,364 Views
lowks
Contributor III

http://cache.freescale.com/files/32bit/doc/app_note/AN4287.pdf?fpsp=1&WT_TYPE=Application%20Notes&WT...

 

I saw the above link on the documentation release. It gives some information on how to port the BSP. But it is not really for the Kinetis series so I try to follow the example and use it on Kinetis. I got two problems:

 

1. At the end of following the steps for CW10, I tried to compile the cloned BSP but it cannot compile. I got the following error:

Description    Resource    Path    Location    Type
make: *** No rule to make target `D:/Work/FIAS/Freescale/Freescale MQX 3.7/mqx/build/Freescale/Freescale MQX 3.7/mqx/source/io/io_dun/io_dun.c', needed by `Generic IO Drivers/io_dun/io_dun.d'.    K10        line 0    C/C++ Problem

2. How do I change the processor to be K10 instead of K60? I tried using the option "Change Device/Connection" but when I click finish after selecting K10, nothing happens. Please note that I am using the bsp_twrk60n512_pe as the base.

 

Please advise. Thanks.

0 Kudos
1,364 Views
lowks
Contributor III

I have solved issue 1 as I realised that all files need to be refresh or relinked. I will like to add some more queries:

 

1. For the PSP, is any modification needed to support K10 from K60?

0 Kudos
1,365 Views
anthony_huereca
NXP Employee
NXP Employee

No, the PSP would remain the same. All changes would be in the \config folder and the \bsp folder.

0 Kudos
1,364 Views
MarkP_
Contributor V

Hi,

Need to run MQX in own K10 board, CW10 is used.

Trying to port bsp_twrk60n512 to own K10 board.

 

Ported K60 headers need to be change for K10:

Freescale MQX 3.7\mqx\source\bsp\twrk60n512\twrk60n512.h

Freescale MQX 3.7\mqx\source\psp\cortex\MK60N512VMD100.h

 

Do you have CPU-specific header files for K10?

Would save a lot of work.

Or are the registers which exist in K10 compatible with K60?

0 Kudos
1,364 Views
MarkP_
Contributor V

Found MK10X256VMD100.h in:

C:\Program_Files\Freescale\CW_MCU_v10.1\MCU\ProcessorExpert\lib\Kinetis\iofiles

Need to be copied into psp-directory (using psp_twr60n512 for K10).

 

0 Kudos
1,364 Views
MarkP_
Contributor V

Hi,

Next problem. I changed RAM size from 128kb(K60) to 64kb(K10), file intflash.lcf:

   ram         (RW): ORIGIN = 0x1FFF8000, LENGTH = 0x00010000  # SRAM - RW data

   # kernel space starts after RAM variables (Location of MQX Kernel data + MQX heap)
   end_of_kd   (RW): ORIGIN = 0x20007FF0, LENGTH = 0x00000000
  
   # Boot stack reused by MQX Kernel data
   bstack      (RW): ORIGIN = 0x20007A00, LENGTH = 0x00000200  # Boot stack
   end_bstack  (RW): ORIGIN = 0x20007BFF, LENGTH = 0x00000000
   ram         (RW): ORIGIN = 0x1FFF8000, LENGTH = 0x00010000  # SRAM - RW data


SECTIONS
{
   __INTERNAL_SRAM_BASE  = 0x1FFF8000;
   __INTERNAL_SRAM_SIZE  = 0x00010000;

Linker gives a warning:

C:/Program_Files/Freescale/CW_MCU_v10.1/MCU/ARM_Tools/Command_Line_Tools/mwldarm|Linker|Warning
>Segment ram have to begin at address aligned to 65536
>Please align ORIGIN of ram segment to 65536

 

How to fix this?

0 Kudos
1,364 Views
MarkP_
Contributor V

This must be wrong, the address 0x20000000 is used directly at memory pool address compare:

 

uint_32 _bsp_enable_card(void)

...

    /* Memory splitter - prevent accessing both ram banks in one instruction */
    _mem_alloc_at(0, (void*)0x20000000);

pointer _lwmem_alloc_at_internal(

     /* [IN] the size of the memory block */    _mem_size      requested_size,

     /* [IN] the addr of the memory block */   pointer        requested_addr,

...

      if ((uchar_ptr)block_ptr + LWMEM_MIN_MEMORY_STORAGE_SIZE <=

                     (uchar_ptr)requested_addr - sizeof(LWMEM_BLOCK_STRUCT) &&
          (uchar_ptr)block_ptr + block_size >=

                     (uchar_ptr)requested_addr - sizeof(LWMEM_BLOCK_STRUCT) + requested_size) {
         /* request fits into this block */

 

block_ptr has value 0x200011b0

requested_addr 0x20000000

 

Don't understand why 0x2000000 is used for compare.

Probably tried to separate RAM-regions [1FFF8000..1FFFFFFF] and [0x20000000..0x20007FFF].

If fails and function returns with "no memory".


map shows:

  1FFF8000 1FFF8000 000013D0 .main_application_bss ram
  20000000 0000D15C 00000820 .main_application_data start_of_ram0
  20000820 20000820 00000000 .kernel_data start_of_ram0
  20007FF0 20007FF0 00000000 .end_of_kernel_data end_of_kd
  20007A00 20007A00 00000000 .boot_stack bstack
  20007BFF 20007BFF 00000000 .end_of_boot_stack end_bstack
  20007BFF 0000D97C 00000018 .romp      end_bstack

File version:

* $FileName: lwm_alli.c$
* $Version : 3.6.16.0$
* $Date    : Nov-10-2010$


0 Kudos
1,364 Views
MarkP_
Contributor V

Kernel data area must start be below 0x20000000. Nice requirement inside the MQX-code.

Problem was generated by my remapping in intflash.lcf (trying to split application and kernel RAM areas):

main_application_data (lower 32kb in K10): 0x1fff8000..0x1fffffff

kernel data at higher 32kb in K10 above 0x20000000.

This works:

  1FFF8000 0000D134 00000820 .main_application_data ram
  1FFF8820 1FFF8820 000013D0 .main_application_bss ram
  1FFF9BF0 1FFF9BF0 00000000 .kernel_data ram
  20007FF0 20007FF0 00000000 .end_of_kernel_data end_of_kd

~Mark

0 Kudos
1,364 Views
Junxiong
Contributor I

Hi Mark ! it seems you have ported the k60's code to k10 successfully . can you send me a example project?

 

I met the same problem, I use k10 and I also want use mqx.

 

thank you!

 

 

0 Kudos
1,364 Views
MarkP_
Contributor V

Hi,

yes, the modified Tower60 libraries (bsp, psp, mfs) runs OK in K10.

Maybe we shall first ask from MQX team, if K10 is supported in new MQX version 3.8.

~Mark

0 Kudos
1,364 Views
MarkP_
Contributor V

Hi,

attached file contains short instructions for K10.

~Mark

0 Kudos
1,364 Views
Thad
Contributor III

Hello Markku,

I've been essentially attempting to reinvent the wheel with the creation of a K10 BSP.  I've had some initial success but keep running into additional things to tweak.  Do you still have a copy of the instruction file you mention?  It might speed my efforts along.

Thanks,

Thad

0 Kudos
1,364 Views
MarkP_
Contributor V

Hello Thad,

The document is not usable, it was for old MQX3.7.

The porting was like this: http://www.freescale.com/files/32bit/doc/app_note/AN4287.pdf

I started from bsp_twrk60n512 (or bsp_twrk60n512_pe when PE is used) and psp_twrk60n512.

Made changes into project, bat etc. files directly by text editor.

Enet etc. stuff need to be removed, they don't exist in K10.

Remember these:

-copy correct K10 header to mqx/source/psp/cortex from

"CW MCU v10.2\MCU\lib\wizard_data\ARM\DataBase\derivatives"

-change user_config.h path in bsb and psp to your project directory

-change CPU in user_config.h:  #define MQX_CPU  PSP_CPU_MK60DN512Z => K10

allowed defines are in Freescale MQX 3.8\mqx\source\psp\cortex\kinetis.h

-Do needed changes into files in Freescale MQX 3.8\mqx\source\bsp\twrk60n512_your_bsp\  (init_gpio.c!)

What kind of problems you have?

~Mark


0 Kudos