Kinetis MKE04Z8VWJ4 region 'm_text' overflowed ____ bytes

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Kinetis MKE04Z8VWJ4 region 'm_text' overflowed ____ bytes

11,591件の閲覧回数
manisht_24
Contributor II

I'm using my own board of MKE04Z8VWJ4 (which is having 32-bit, Flash memory - 8KB, RAM - 1KB), when I'm trying to Initialize the timer and ADC components using Predefined functions (Shown in IMG003), it shows the error "region `m_text' overflowed by 396 bytes". Even I have not added my own code in the project yet.

          Someone on this community suggested code optimization setting for the similar problem. After changing the optimization level to "Optimize size(-Os)" above error is gone.

          But when i am trying to write my code (size 3K) it is showing same error again.

How to resolve this error?? 

Kindly go through Attached Images and Code.

0 件の賞賛
返信
12 返答(返信)

11,587件の閲覧回数
bobpaddock
Senior Contributor IV

As you have probably deduced m_text overflow means there is more code than there is Flash space for it.

Try upgrading to the recent MCUXPresso and SDK.  GCC 4.7.x is rather old.  There have been some improvements in optimization since then.  Also the newer SDK generates better code than Code Warrior did.

Ultimately a small part like the 04 may simply not have the capacity for the application at hand.


0 件の賞賛
返信

11,575件の閲覧回数
manisht_24
Contributor II

Thanks For Replying Bob.

But without writing single line of code why it is showing code size of 6168 (You can see in the attachment)? I have only created components required for my Project. Out of 8K flash 6168 memory is consumed without writing single line of code.  am I doing something wrong in creating project? 

0 件の賞賛
返信

11,552件の閲覧回数
bobpaddock
Senior Contributor IV

In addition to using the -Os small model there are other options that can be added to the Makefile to reduce code further, if they are not already in the Makefile.

This is example from my own Makefile, the variables CFLAGS and LDFLAGS are likely to have different names in your Makefile.

# Add

# "-Os -ffunction-sections -fdata-sections"

# to the compiler section of the Makefile, plus

# "--gc-sections"

# to the linker section of the Makefile. This will ensure that the
# code is optimized for smallest size, and that unused code and data
# are removed.

# "-u symbol,main"

# Pretend the symbol symbol is undefined, to force linking of library
# modules to define it. "-u" can be used multiple times with different
# symbols to force loading of additional library modules.

CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += -Wl,-gc-sections,-u,main

# Things such as Interrupt routines and some start up code may need to
# be marked with an 'used' attribute, to keep needed code from being
# removed.  Look at the .map and .sym files.

# The official GCC list of command line options:
# https://gcc.gnu.org/onlinedocs/gcc/Option-Index.html

 

0 件の賞賛
返信

11,548件の閲覧回数
manisht_24
Contributor II

Thanks for Replying bobpaddock

Please find an attached SS. If i am not wrong are you suggesting to make the changes in the Makefile located in FLASH folder?

Which changes and where should i make can you please Elaborate?

       Also Can i program MKE04Z8VWJ flash with "PE Micro Multilink Universal" tool using MCUxpresso IDE v11.4.0_6237?

If Yes, How can i program?

0 件の賞賛
返信

11,545件の閲覧回数
bobpaddock
Senior Contributor IV

I use this program with my Multilink:

https://www.pemicro.com/products/product_viewDetails.cfm?product_id=15320181&productTab=1

The Makefile in the Flash folder is generated by the project.  Changes there can be overwritten.
I've rarely used Code Warrior, so I can't really help you there, other than to say the change needed is in one of the 'included' sub Makefiles, and some setting changed to not overwrite the changes.

You really should move to the modern MCUXpresso and SDK.
You may find it generates significantly smaller code out of the box, then again it might not, no way to know without trying.  That should also support programming the device without using an external program.


 

0 件の賞賛
返信

11,534件の閲覧回数
manisht_24
Contributor II

Thanks bobpaddock

As suggested by you I am trying my code on MCUXpresso and SDK. and size of Blank generated code is reduced as compare to Codewarrior10.X project. 

         Though finding little uncomfortable in  a new environment of MCUXpresso. Like How to define IOs, timer, ADC. is there any video to learn these things? 

0 件の賞賛
返信

11,516件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi, 

With MCUXpresso, you can use config tools to configure peripherals.  There is a config tool user guider in the installation folder.

danielchen_0-1630156362248.png

 

Regards

Daniel

0 件の賞賛
返信

11,491件の閲覧回数
manisht_24
Contributor II

Thank you danielchen.

0 件の賞賛
返信

11,527件の閲覧回数
bobpaddock
Senior Contributor IV

I'm not a lot of help answering that question.

I don't use it other than to see how initialization code is generated.

Look over Erich's site, starting with this:

https://mcuoneclipse.com/2021/07/21/mcuxpresso-ide-11-4-0/https://mcuoneclipse.com/


 

 

 

0 件の賞賛
返信

11,522件の閲覧回数
manisht_24
Contributor II

Thank you bobpaddock & Erich,

          I am referring the site Suggested by Erich. Now Getting things clear slowly.

0 件の賞賛
返信

11,571件の閲覧回数
ErichStyger
Specialist I

You have to keep in mind that examples come with lots of things your might not aware of: startup code, library code, asserts, ...: they are there to make somewhat 'your starting point easier', but at the end you are responsible to get things in and out. Somewhat related: here is such a process with the SDK (not Processor Expert): https://mcuoneclipse.com/2019/08/17/tutorial-how-to-optimize-code-and-ram-size/

A single (unwanted) printf() might add several kBytes of code to your application. I recommend you have a look at your .map file to see what is using how much. As you can see with the above article, with the right knowledge and a bit of work with knowing what you do you can get a minimal 'blinky' down to a few hundred bytes.

I hope this helps,

Erich

0 件の賞賛
返信

11,562件の閲覧回数
manisht_24
Contributor II

Thanks for the reply ErichS. I will keep this in mind.