64k flash programming

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

64k flash programming

跳至解决方案
6,063 次查看
namirnehemia
Contributor I

Hi,

I got thr MKL16Z64VFT, that is a 64K flash. On the chip itself I read M16M6VFT.

Using the development SW, I can program only 32K of program.

What am I doing wrong?

Thanks

0 项奖励
回复
1 解答
5,415 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

    I already find the root problem, it is really very difficult to find it if you don't give us the project.

    Your problem is not caused by the chip hardware, also not the code itself, it is caused by the debug configuration in the codewarrior.

    You select the KL16Z32M4 not the KL16Z64M4, then the debug will use the 32K to debug your code, after your code larger than 32K, it will have problem.

  This picture is from your debug configration: run->debug configuration

23.jpg

Please modify it to MKL1664M4.

24.jpg

After you modify it, then click ok, and debug, your problem will disappear!

Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

21 回复数
5,383 次查看
davidra7
Contributor I

Hey,

Sorry for the delay, Just wanted to thank you ! it was very helpfull and you solved my problem.

Thanks again!!

David

0 项奖励
回复
5,379 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

   That's very good to hear your problem is solved.

   Now, could you please mark this post as solved?

  Just click the correct answer button, thank you~!

Best Regards,

Jingjing

0 项奖励
回复
5,379 次查看
davidra7
Contributor I

I will ask Nehemia to do so because he open the thread.

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hey,

I add another line with WAIT component and it crashes, I can send it only to you.

How to send it?

is there a way to check how much RAM is left ?

Thanks,
David

0 项奖励
回复
5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi  David R,

    Please follow this picture, and printf the project size information:

19.jpg

    Then give me your project size information picture , data+bss will use the RAM size.

    You should better give us your project, then we can help you to check it whether it is caused by the copy to ram function or not.

    After we get your project, you can delete the attachment.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hi,

I really appriciate your help!! thank you!

the print of the size is below

"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-size"  --format=berkeley -x -t Me4_Base.elf

  text  data    bss    dec    hex filename

0x7cec  0x38  0x4cc  33264  81f0 Me4_Base.elf

0x7cec  0x38  0x4cc  33264  81f0 (TOTALS)

I added the project in here and I will send you the password in email , give me your work email address.

Thanks,
David

0 项奖励
回复
5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

      Please use the optimize to do the code optimization, then try again, I use it, then the code won't enter the interrupt.

    21.jpg

    You can choose the optimize level to 3, then try again on your side.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hey ,

I don't to optimize because it is hard to debug the code , I tried to change the TSS component to GPIO method and it got better but adding some code give the same error.

I think that there is something with the TSS library , can you check it ?

Thanks,
David

0 项奖励
回复
5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David,

   Ok, I will continue to help you check it, but it may need time, after I find the root problem, I will tell you immediately, so please wait patiently!

Best Regards,

Jingjing

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hi,

thanks again for your help!

David

0 项奖励
回复
5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

  Did you solve your problem after follow my steps?

  Any other question else?


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
5,416 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

    I already find the root problem, it is really very difficult to find it if you don't give us the project.

    Your problem is not caused by the chip hardware, also not the code itself, it is caused by the debug configuration in the codewarrior.

    You select the KL16Z32M4 not the KL16Z64M4, then the debug will use the 32K to debug your code, after your code larger than 32K, it will have problem.

  This picture is from your debug configration: run->debug configuration

23.jpg

Please modify it to MKL1664M4.

24.jpg

After you modify it, then click ok, and debug, your problem will disappear!

Wish it helps you!

If you still have question, please contact me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David R,

    Our workflow is supporting the customer through the community with the post, the email is confidential.

    Now, please follow me at first, and send me your password in the community message.

Waiting for your password.

Jingjing

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hi Santiago & Jingjing,

I added the Hard Fault handler it it seems to break in __copy_rom_section function , I tried to remove some data and still the same.

Some Questions:

1. my m_data(RAM) section start in 1FFFF800 address and has length of 0x2000 , is it correct ?

2. I tried to move to SysV and get the next data:

section                 size         addr

.interrupts             0xc0          0x0

.cfmprotect             0x10        0x400

.text                 0x7c1c        0x410

.data                   0x20   0x1ffff800

.bss                   0x2cc   0x1ffff820

.romp                   0x18   0x1ffffaec

._user_heap_stack      0x200   0x1ffffb04

.ARM.attributes         0x31          0x0

.debug_info           0xbbc3          0x0

.debug_abbrev         0x2e33          0x0

.debug_loc            0x3316          0x0

.debug_aranges         0xbd8          0x0

.debug_macinfo      0x7e0687          0x0

.debug_line           0xad57          0x0

.debug_str            0x4756          0x0

.comment                0x79          0x0

.debug_frame          0x1fd8          0x0

Total               0x80c68a

Can I understand something from here? because my calcluation it should be fine.

I really don't understand how I got RAM full , Any Ideas?

if you have a way to check the occupied RAM I will be glad to hear it

Thanks,

David

0 项奖励
回复
5,383 次查看
santiago_gonzal
NXP Employee
NXP Employee

Hello David,

Everything seems correct, the RAM is defined correctly. The Kinetis KL16 has 2 blocks of RAM:

- RAM_L: From 0x1FFF_F800 to 0x1FFF_FFFF. 2kB

- RAM_H: From 0x2000_0000 to 0x2000_1800. 6 kB

I don't understand what's going on, and without debugging it, is difficult to guess it.

What do you change to make it crash? Can you share your code?


Regards,

Santiago

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hi,

I checked a it and it handles very wierd, I wrote code for EEPROM I2C and it worked , but after I go over 32K this code stops running and throws Hard Fault ( I can see it in debugging step )

The problem is the SendBlock function, when I remove it the code is running ( same behavior with sendChar).

My code is very simple:

CI2C1_Enable();
// set address
res += CI2C1_SelectSlave(0x50);
res = CI2C1_SendChar(buffer);//setting read address

my I2C settings ( I tried with/without Interrupt)

pastedImage_2.png

do you have any suggestions ?

Thanks,

David

0 项奖励
回复
5,383 次查看
santiago_gonzal
NXP Employee
NXP Employee

Hello David,

As Jingjing says, I think your problem has nothing to do with the size of the code. If you can program it, the issue is not the size of the binary. Maybe you're running out of RAM memory or you're having other type of problem, but I doubt the issue is the size.

You should analyze the flow of the code and try to understand what's going on.

Regards,


Santiago

0 项奖励
回复
5,383 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi David,

   I think you should follow the code to check which code in SendBlock function caused the hard fault.

   Please follow this post to check out which line cause the CPU enter in the hard fault.

Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse

   After you find the detail code, please give us the picture.

   If you still not OK, please upload your project directly!

Best Regards,

Jingjing

0 项奖励
回复
5,383 次查看
santiago_gonzal
NXP Employee
NXP Employee

Hello,


What development SW are you using? Have you created a new project or are you using an example? How do you know that the memory that you can program is only 32 Kb?

Regards,

Santiago

0 项奖励
回复
5,383 次查看
davidra7
Contributor I

Hi,

I will answer instead of Nehemia, I am using eclipse Codewarrior 10.6. I created a new project with my controller

It worket perfectly until I go over 32KB code size , when I delete some code to be under 32K it worked again. I verifed that the text section is 64K.

Attached picture with configuration of the CPU include the text section( it is default ).

Also , When I program more than 32K if fall on PE_ISR(Cpu_Interrupt) from function __copy_rom_sections_to_ram.

Thanks,
David

0 项奖励
回复