platform-timsp430 icon indicating copy to clipboard operation
platform-timsp430 copied to clipboard

128kByte on MSP430F5529

Open WolfgangAipperspach opened this issue 4 years ago • 3 comments

There is a flash memory section at 0x10000 extending the main memory at 0x4400. This memory is not supported by PlatformIO

WolfgangAipperspach avatar May 10 '21 13:05 WolfgangAipperspach

here is the solution: https://community.platformio.org/t/msp430-use-all-128kb-not-just-47kb/21326 special thanks to @maxgerhardt

WolfgangAipperspach avatar May 17 '21 15:05 WolfgangAipperspach

can the solution be integrated into PlatformIO?

WolfgangAipperspach avatar May 17 '21 15:05 WolfgangAipperspach

For anyone reading, here's a short summary of the topic:

  • allowing firmwares to use the "high" memory starting at 0x10000 requires
    1. turning on a compiler option for "large-model addressing, 20-bit pointers" (as opposed to small-model addressing, 16-bits)
    2. either manually placing variables and/or code in high memory or letting the compiler decide
  • The GCC docs say this option is -mlarge (together with -mcode-region=.., -mdata-region=..), but the compiler version used by PlatformIO (toolchain-timsp430, version 4.6.4, based on https://sourceforge.net/projects/mspgcc/) does not support this flag (gives error message unrecognized command line option ‘-mlarge’)
  • I could not get large-model addressing to work with the toolchain PlatformIO uses
  • the above linked compiler says it's been superseed by Texas Instrument's GCC version, with this manual, based on GCC 9.3.1
  • with a modified platform-timsp430 (which respects the new compiler executable filenames and adds -mlarge -mcode-region=either -mdata-region=either in build and linker flags) and a re-upload of the TI GCC version (https://github.com/maxgerhardt/pio-toolchaintimsp430-new), fully using the full 128 kByte of the microcontroller's flash finally works in a fully automatic way (compiler puts const. variables and functions in higher memory areas as needed, or when explicitly requested)
  • Example of that is at https://github.com/maxgerhardt/pio-timsp430-new-toolchain-example
  • It's unknown to me whether the other SDKs (Arduino etc) like the newer compiler, might be better to stay at the old one for non-baremetal projects

maxgerhardt avatar May 17 '21 17:05 maxgerhardt