Inbuilt flash memory size not enough

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. A printf 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.