How to play with linker file in Kinetis K20?

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

How to play with linker file in Kinetis K20?

654 Views
sanketkulkarni
Contributor III

K20 Kinetis on  Code warrior 10.4: 

We are trying to make a SAP file for 32K bootloader and 224K Code size. But we are short on Code size and getting overflow error. How can I reduce Code size. I need around 16KB to free.

1. We have some configurations on Flash, and Some arrays declared as const, can we program them from sAP insted of Declaring in code.

------>Others:

1. We are trying to make a SAP file of bootloader of 32KB and 224 KB Code.

2. We have array of Image of 4K defined as constant, and is saved at 0x10003000 in Flash.

3. Any suggestions on saving space for array defined as const. which can save space.

4. Also, Can I program Flash range 0x10003000 using Program Range in cyclone ARM MAX Programmer.

5. We have 7-8 configuration of arrays on Flash, Can I program them by making .txt file out of configuration parameters, and then program it using SAP File using these text file.

6. also I have seen Linker file declared as ROM, can i use this for my goal in following linker script.  

MEMORY {
m_interrupts (RX) : ORIGIN = 0x00008000, LENGTH = 0x000001BC
m_text (RX) : ORIGIN = 0x00008420, LENGTH = 0x00037BF0 
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00010000
m_cfmprotrom (RX) : ORIGIN = 0x00008400, LENGTH = 0x00000010
}

Please help me on this? If you can give Practical examples of playing with linker would be great. 

Labels (1)
Tags (1)
0 Kudos
3 Replies

544 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

1.I K20 series has different memory size and various combinations. What is your k20 part number?

2.If your current code size isn't overflow too much, you can try higher optimize level like -O3 or -Os.

3.In the link file, there is such a item

       m_cfmprotrom (RX) : ORIGIN = 0x00008400, LENGTH = 0x00000010

This is useless. In kinetis device, address 0x400~0x410 is flash configuration field. Hardware will read this field and take this as flash configuration. But it is no use to put it in 0x8400.

4. SAP file is defined by P&E. I think you'd better ask your question on P&E forum. They can give you better answer.

Regards,

Jing

0 Kudos

544 Views
sanketkulkarni
Contributor III

1. Part no is:  MK20DX256VLL7

2. Till date what my steps are: 

   1. I have cut the code size by commenting the not necessary generated code.

   2. To save space I am loading configuration of 16K read from Device in SAP File, i.e., from address 0x10000000.

   3.  
:DEVICE NXP_K2x_K20DX256M7
:USESWD 1
CM C:\PEMicro\cyclone_max\supportFiles_ARM\NXP\K2x\freescale_k20dx256m7_pflash_dflash_eeprom.arp
EM ;Erase Module
SS E:\Project Sanket\11MAY16_OTAF_Bootloader.afx.S19
PA 3502 ;PARTITION
PM ;Program Module
VM ;Verify Module
SS E:\Project Sanket\InnovaModel1Proj.afx.S19
PR 8000 3FFFF
VR 8000 3FFFF
SS E:\Project Sanket\Flex_NVM2.s19
PR 10003000 10003FFF
VR 10003000 10003FFF
DE 2000
RE ;Reset
DE 2000
GO ;Run

4. Is disabling generated code or loading CFG from SAP causing issue.

0 Kudos

544 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

Yes, K20DX256VLL7 has 32k data flash. If you don't use eeprom function, you can put a lot of data in it.

In PEmicro forum, there is several discuss on how to use SAP file, for example

PEmicro | Experts in Embedded tools for Flash Programming and Development 

0 Kudos