9 years, 10 months ago.

LPC8XX Board UART question

Team

When I use Serial on LPC812 (and I am guessing on LPC824 too) it uses about 6 kb of flash memory in mbed.

I was wondering if theres a Serial port implementation to use the ROM APIs that come with LPC8xx chip. Will save enormously on code spaces. That will save us close to 40% memory in my LPC812

Best regards Ram k

1 Answer

9 years, 10 months ago.

The problem isn't as much the serial (UART) code, which should be small enough, but that it uses stdio to handle alot which is not really required. Switching from Serial to RawSerial should already reduce the memory footprint.

In general it works on the LPC812, but some overhead stuff which is tiny on other mbed targets, is huge here.

Accepted Answer

Awesome. Reduced code size by about 4kb.

Will I have toruble if i move to LPC824?

posted by ram k 30 Jan 2015

No, RawSerial is independent of target and works on every platform. It simply skips most of the stdio stuff and does stuff directly. Normal Serial if you do putc it will first go through the standard C library, set some stuff, do some other stuff (not a clue what exactly), and in the end call the _putc() function that serial has internally. RawSerial just calls that directly.

And glad that it indeed helps alot for you :).

posted by Erik - 30 Jan 2015