PlatformIO Support for NXP LPC2148

I’m not sure how to configure PlatformIO for the NXP’s LPC2148 MCU. I hope someone here can help.

I found one of maxgerhardt’s great repositories which supports PlatformIO on NXP LPC2134 microcontroller, but nothing for the LPC2148, the IDE documentation here does not give examples for these boards.

LPC2148 has same core as LPC2134, but has 512K flash memory, 32K RAM, plus 8K shared RAM with USB DMA.

Here’s maxgerhardt’s PlatformIO.ini file for LPC2134

; value will be read by python script. analogous to Makefile
FLASH_BAUD = 57600
MCU_CLOCK = 11059

platform = nxplpc
; use custom board definition for NXP LPC 2134/01
board = lpc2134_01
; use same linkerscript as Makefile uses
board_build.ldscript = T-962-controller.ld
; remove default thumb mode flag
build_unflags = -mthumb
; reproduce build flags from Makefile
build_flags = -DNDEBUG -D__NEWLIB__ -fno-builtin -fmessage-length=0 -flto -ffat-lto-objects -Wl,-u_printf_float -Wl,-u_scanf_float
; add -nostdlib to linkerflags via script; cannot be done via build_flags in this case
; see Redirecting...
; also creates additional HEX file (otherwise only .elf and .bin are there, but uploader needs .hex)
; reproduce creation of version.c file, as Makefile does (could also work without, but why not…)
extra_scripts =
; upload via custom lpc21isp program.
; precompiled binaries for Windows and Linux exist in this directory. Assume Windows by default
upload_protocol = custom
;if explicit upload port is needed (will be auto-detected otherwise)
;upload_port = COM1

I see in his source code files, he includes a file called LPC214x.h that looks to support all LPC2148 features. That’s good.

Also, his board file ( boards/lpc2134.json ) which is referenced in the PlatformIO.ini file, looks like this.

“build”: {
“cpu”: “arm7tdmi”,
“f_cpu”: “55296000L”,
“mcu”: “lpc2134”
“connectivity”: [
“debug”: {
“jlink_device”: “LPC2134”,
“pyocd_target”: “lpc2134”,
“svd_path”: “LPC176x5x_v0.2.svd”
“frameworks”: [
“name”: “NXP LPC2134/01”,
“upload”: {
“maximum_ram_size”: 16384,
“maximum_size”: 131072,
“protocol”: “mbed”,
“protocols”: [
“url”: “Single-chip 16/32-bit microcontrollers; 32/64/128/256/512 kB ISP/IAP flash with 10-bit ADC and DAC | NXP Semiconductors”,
“vendor”: “NXP”

Is this just informational, or does PlatformIO need it when generating the firmware hex file?

Here’s a link to maxgerhardt’s repository.


Can that firmware be uploaded onto your LPC2148? If it’s just a bigger LPC2134, it should be running.

The LPC214x.h file doesn’t even distunguish between any sub-chips, it’s all the same to it.

Thanks for the reply. I haven’t tried that yet, but you’re probably right.

I have since successfully used the FlashMagic utility to burn a 3KB hex file on the LPC2148. But this hex file was not generated by PlatformIO.

With the same hex file, if I change FlashMagic’s MCU settings from LPC2148 to LPC2134, FlashMagic, gives a warning about seeing an unexpected Signature

LPC2134 Signature: 0x0002FF12 (196,370)
LPC2148 Signature: 0x0402FF25 (67,305,253)

FlashMagic gives an option to ignore the signature and flash the file anyway; which it does and the hex file program I used runs the same as before…

Both MCUs have the same start addresses for Flash and RAM, but the sizes are different:

LPC2134 Flash Memory: Start addr: 0x00000000 Size: 0x00020000 (11 sectors)
LPC2148 Flash Memory: Start addr: 0x00000000 Size: 0x0007D000 (27 sectors)

LPC2134 RAM Memory: Start addr: 0x40000000 Size: 0x00004000
LPC2148 RAM Memory: Start addr: 0x40000000 Size: 0x00008000

I was hoping there was an easy way to configure a board file for the LPC2148.