I am using TM4C1230C3PMI controller from Texas instrument in one of my project. It has 32KB of internal flash, which is not sufficient for my application. Higher flash sized micro-controller are available in the market which can be used but I want to go with this micro-controller only. As per my knowledge external EEPROM can be used to increase the total flash size (Program memory).
Is my thinking is correct?
If not please suggest how can I increase the total flash memory size of the controller?
-
1\$\begingroup\$ External EEPROM is typically used for storing data because the internal Flash allows less erase/write cycles then most EEPROMs and it can be overwritten byte-wise. For CPUs with an external bus interface (your one does not have this) it would be possible to add external program memory (however this is a bit complicated...). Theoretically it would be possible to store pieces of code in an external EEPROM and to load this code into RAM to execute it - however in most cases this scenario is not realistic. \$\endgroup\$Martin Rosenau– Martin Rosenau2015年06月27日 16:38:12 +00:00Commented Jun 27, 2015 at 16:38
-
3\$\begingroup\$ Many years ago, a related maxim was "If you can't do it in 1K, you can't do it." I thought it was clever and worth thinking about, but didn't really accept it. Then MicroChess arrived in 1K. \$\endgroup\$user2338816– user23388162015年06月28日 03:30:53 +00:00Commented Jun 28, 2015 at 3:30
-
1\$\begingroup\$ Why dont you boot your code from an external memory? There are a number of external memories that can be interfaced to your uC. This will not place constraints on your internal flash as you will be booting your code externally. \$\endgroup\$AlphaGoku– AlphaGoku2016年03月17日 05:36:11 +00:00Commented Mar 17, 2016 at 5:36
-
\$\begingroup\$ What are some refactoring methods to reduce size of compiled code?, How to Reduce Code Size (and Memory Cost) Without Sacrificing Performance, How to reduce program size, Writing Efficient C and C Code Optimization \$\endgroup\$phuclv– phuclv2016年03月17日 07:48:22 +00:00Commented Mar 17, 2016 at 7:48
-
\$\begingroup\$ Code size optimization forembedded processors \$\endgroup\$phuclv– phuclv2016年03月17日 07:49:00 +00:00Commented Mar 17, 2016 at 7:49
2 Answers 2
You cannot extend the program memory (flash). TI produces the same chip with double the flash and RAM, but nothing else changed: TM4C1230D5PMI.
If you cannot use a chip with larger flash, you will have to reduce your code size:
- Disable debugging, such as the expensive
printf
function. Aprintf
that supports floating point output will typically set you back around 5KB-10KB. - Make sure you compile with optimization enabled - typically the compiler flag is
-Os
. - Modern compilers can do link time optimization (LTO). With gcc, you get this with
-flto
. You have to pass-flto
to both compilation and link stages, for all files. This typically reduces the produced code size by 30%-50%.
You might get the smallest software footprint by using assembler and a Forth-like language designed for your purpose. Another is compressed machine code if there is a lot of almost identical code.
Explore related questions
See similar questions with these tags.