Change MCU and Linkerfiles from heart rate monitor example to MKW31Z

cancel
Showing results for 
Search instead for 
Did you mean: 

Change MCU and Linkerfiles from heart rate monitor example to MKW31Z

1,259 Views
robertnäger
Contributor II

Dear Community

For my final project I started programming on the FRDM KW41Z development board. But now my own PCBA with a MCU MKW31Z is manufactured and works fine. Therefore, I would like to change the target MCU from FRDM KW41Z to MKW31Z and its linker files using the example project heart rate monitoring.

Anyway, I managed to build and debug my PCBA with an empty project. It worked fine.

I read many instructions how changing the target MCU but I have not solved the problem to change the linker files that it compiles. I tried to adapt my code like E. Styger advised: Tutorial: Porting BLE+NRF Kinetis Design Studio Project to MCUXpresso IDE | MCU on Eclipse but taking the project settings form the heart rate monitor project to a new one.

However, I could not manage to work, because the linker files looked also a little bit different.

After building I get following errors:


make: *** [MKW31Z256xxx4_braking_disc_control_unit.axf] Error 1 MKW31Z256xxx4_braking_disc_control_unit C/C++ Problem
undefined reference to `__RAM_VECTOR_TABLE_SIZE_BYTES' fsl_common.c /MKW31Z256xxx4_braking_disc_control_unit/drivers line 114 C/C++ Problem
undefined reference to `__VECTOR_RAM' fsl_common.c /MKW31Z256xxx4_braking_disc_control_unit/drivers line 114 C/C++ Problem
undefined reference to `__VECTOR_TABLE' fsl_common.c /MKW31Z256xxx4_braking_disc_control_unit/drivers line 114 C/C++ Problem
undefined reference to `FREESCALE_PROD_DATA_BASE_ADDR' Flash_Adapter.c /MKW31Z256xxx4_braking_disc_control_unit/framework/Flash/Internal line 529 C/C++ Problem
undefined reference to `roundf' fsl_xcvr_trim.c /MKW31Z256xxx4_braking_disc_control_unit/framework/XCVR/MKW41Z4 line 675 C/C++ Problem
undefined reference to `roundf' fsl_xcvr_trim.c /MKW31Z256xxx4_braking_disc_control_unit/framework/XCVR/MKW41Z4 line 679 C/C++ Problem
undefined reference to `roundf' fsl_xcvr_trim.c /MKW31Z256xxx4_braking_disc_control_unit/framework/XCVR/MKW41Z4 line 723 C/C++ Problem
undefined reference to `roundf' fsl_xcvr_trim.c /MKW31Z256xxx4_braking_disc_control_unit/framework/XCVR/MKW41Z4 line 724 C/C++ Problem

Thank you really much.

Robert

0 Kudos
9 Replies

893 Views
robertnäger
Contributor II

Hi again,

I spent some more time solving this issue and I recognized, that an empty project has another structure than the heart rate monitor example. At the example they use a self made linker file MKW41Z512xxx4_connectivity.ld. But generating a new empty project choosing the MKW31Z family generate 3 linker files in the folder "Debug".

However, do you offer any linkerfile for the MKW31Z which I could replace with the existing MKW41Z512xxx4_connectivity.ld ? The structure of this file should be same, but other section because the memory is limited. Editing the MKW41Z512xxx4_connectivity.ld file might be dangerous and difficult to get it right, I think.

How should I solve this issue?

Cheers

Robert

0 Kudos

893 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Robert,

Does your project for kw41 can work well already on MCUXPresso IDE ?

If yes,  I recommend you compare the flash memory between the two chips , then change the linker file for KW41 to

KW31.  Or create a new project of KW31, refer to Erich's blog and kw41 linker file to configure.

For the two chips' flash, just the size is different, we can see from the default three linker files, only the

"Debug_memory.ld" distinction.

pastedImage_1.png

BR

Alice

893 Views
robertnäger
Contributor II

Hello Alice

Thank you for your response.

Yes it does work well on the FRDM KW41Z. I am using the example for the heart rate monitor and added some code for my application. The BLE communication works well. But I recognized the structure of the imported project of the heart rate monitor is different. That means there is only one linker file which is called MKW41Zxxx_connectivity.ld and is in the folder source and not in folder Debug. My assumption is, that this linker file was not automatically generated and has therefore this different structure. I would like to know, which values I have to change in the MKW41Zxxx_connectivity.ld file to adapt it to the MKW31Z.

I hope, it is clear what I mean

Best regards

Robert

PS: I expected changing the linkerfiles and target MCU's is simpler.

0 Kudos

893 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Robert,

Please share your file of MKW41Zxxx_connectivity.ld .

BR

Alice

0 Kudos

893 Views
robertnäger
Contributor II

Hei Alice

Following is the MKW41Zxxx_connectivity.ld from the example heart_rate_monitor with BLE stack. I have not changed anything.

Thank you

Robert

ENTRY(Reset_Handler)
_RAM_START_ = (0x1FFF8000);
_RAM_END_ = (0x20017FFF);
FREESCALE_PROD_DATA_BASE_ADDR = ((0x0007FFFF) - ( 2 * 1024 ) + 1);
NV_STORAGE_SECTOR_SIZE = ( 2 * 1024 );
NV_STORAGE_MAX_SECTORS = (4);
NV_STORAGE_START_ADDRESS = ((0x0007FFFF) - ( 2 * 1024 ) + 1) - 1;
NV_STORAGE_END_ADDRESS = NV_STORAGE_START_ADDRESS - (NV_STORAGE_MAX_SECTORS * NV_STORAGE_SECTOR_SIZE) + 1;
__RAM_VECTOR_TABLE_SIZE = ((48*4));
__BOOT_STACK_ADDRESS = ((((((0x20017FFF)) - (384)) - 1) - (0) - 0x4) - 1)-0x0F;
__dummy_start = 0x1FFFFFFB;
MEMORY
{
TEXT_region1 (RX) : ORIGIN = (((0x00000000))), LENGTH = ((0x400) - (((0x00000000))))
m_flash_config_region (RX) : ORIGIN = (0x400), LENGTH = ((0x410) - (0x400))
TEXT_region2 (RX) : ORIGIN = (0x410)+1, LENGTH = ((((((0x0007FFFF) - ( 2 * 1024 ) + 1) - 1) - (((4)) * (( 2 * 1024 ))) + 1) - 1) - (0x410) - 1)
NVM_region (RW) : ORIGIN = ((((0x0007FFFF) - ( 2 * 1024 ) + 1) - 1) - (((4)) * (( 2 * 1024 ))) + 1), LENGTH = ((((0x0007FFFF) - ( 2 * 1024 ) + 1) - 1) - ((((0x0007FFFF) - ( 2 * 1024 ) + 1) - 1) - (((4)) * (( 2 * 1024 ))) + 1))
DATA_region (RW) : ORIGIN = (((0x1FFF8000))), LENGTH = ((0x20017FFF) - (0x1FFF8000) + 1)
PRODUCT_INFO_region (RX) : ORIGIN = ((0x0007FFFF) - ( 2 * 1024 ) + 1), LENGTH = (((0x0007FFFF)) - ((0x0007FFFF) - ( 2 * 1024 ) + 1))
}
SECTIONS
{
.interrupts :
{
__VECTOR_TABLE = .;
. = ALIGN(4);
KEEP(*(.isr_vector))
. = ALIGN(4);
} > TEXT_region1
.freescale_prod_data :
{
. = ALIGN(4);
KEEP(*(.FREESCALE_PROD_DATA))
. = ALIGN(4);
} > PRODUCT_INFO_region
.flash_config :
{
. = ALIGN(4);
KEEP(*(.FlashConfig))
. = ALIGN(4);
} > m_flash_config_region
.text :
{
. = ALIGN(4);
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)
*(.glue_7)
*(.glue_7t)
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
} > TEXT_region2
.NVM_TABLE :
{
. = ALIGN(4);
PROVIDE(__start_NVM_TABLE = .);
KEEP(*(.NVM_TABLE));
PROVIDE(__stop_NVM_TABLE = .);
. = ALIGN(4);
} > TEXT_region2
.VERSION_TAGS :
{
. = ALIGN(4);
PROVIDE(__start_VERSION_TAGS = .);
KEEP(*(.VERSION_TAGS));
PROVIDE(__stop_VERSION_TAGS = .);
. = ALIGN(4);
} > TEXT_region2
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > TEXT_region2
.ARM :
{
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} > TEXT_region2
.ctors :
{
__CTOR_LIST__ = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
} > TEXT_region2
.dtors :
{
__DTOR_LIST__ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
} > TEXT_region2
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} > TEXT_region2
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} > TEXT_region2
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} > TEXT_region2
__etext = .;
__DATA_ROM = .;
.mtb :
{
. = ALIGN(8);
_mtb_start = .;
KEEP(*(.mtb_buf))
. = ALIGN(8);
_mtb_end = .;
} > DATA_region
.interrupts_ram :
{
. = ALIGN(4);
__VECTOR_RAM__ = .;
__interrupts_ram_start__ = .;
*(.m_interrupts_ram)
. += ((48*4));
. = ALIGN(4);
__interrupts_ram_end__ = .;
} > DATA_region
__VECTOR_RAM = __VECTOR_RAM__;
__RAM_VECTOR_TABLE_SIZE_BYTES = (__interrupts_ram_end__ - __interrupts_ram_start__);
.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .;
*(.data)
*(.data*)
KEEP(*(.jcr*))
. = ALIGN(4);
__data_end__ = .;
} > DATA_region
__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
text_end = ORIGIN(TEXT_region2) + LENGTH(TEXT_region2);
ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
.bss :
{
. = ALIGN(4);
__START_BSS = .;
__bss_start__ = .;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
__END_BSS = .;
} > DATA_region
.heap :
{
. = ALIGN(8);
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += (0);
__HeapLimit = .;
} > DATA_region
.stack :
{
. = ALIGN(8);
. += (384);
} > DATA_region
__StackTop = ORIGIN(DATA_region) + LENGTH(DATA_region);
__StackLimit = __StackTop - (384);
PROVIDE(__stack = __StackTop);
.ARM.attributes 0 : { *(.ARM.attributes) }
.dummy __dummy_start :
{
. += 8;
} =0x90909090
ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
}

0 Kudos

893 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Robert,

Please try this linker file I attached. I just refer to the memory size information of the two chips to

configure it , also didn't test it on the project. If have any problem , please share it .

Hope it helps

ALice

0 Kudos

893 Views
robertnäger
Contributor II

Dear Alice

Thank you for your fast response. But I do not see the attached file.

Cheers

Robert

0 Kudos

893 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi

How about this one ?

Alice

893 Views
robertnäger
Contributor II

Cheers.

I will test it out.

Best regards

Robert

0 Kudos