GPIOWorks
Self-test calls: HAL_GPIO_Init, HAL_GPIO_WritePin, HAL_GPIO_TogglePin, HAL_GPIO_ReadPin
PA0 set, clear and toggle read back 1, 0, 1; read after a 100 us wait matched the written level.
Fox Red Labs / Ports / STM32 to MSPM0
Mostly yes: one header and one C file move HAL code for GPIO, pin interrupts, UART (blocking, interrupt and DMA), I2C, SPI, ADC, timers and PWM, flash and the watchdog to the MSPM0 G3507, and the calls keep their ST names. The self-test on the board (2026-11-13) passes 15 of 16 checks and skips 1, the PWM pin level, which needs a wire from PA26 to an input; one unmodified ST library, afiskon/stm32-ssd1306, builds against the shim.
Not yet proven: a device answering on I2C, the PWM pin level and ADC accuracy against a known voltage. CAN, RTC, USB, SD, Ethernet and LL calls are not covered.
The path of one call. You keep your HAL code; the shim (red edge) is the only new layer, and it answers with TI's own DriverLib calls.
One card per area. Works means a run on the board checked the behavior. Should work means the code builds and no run checked the behavior; the card says what is missing.
Self-test calls: HAL_GPIO_Init, HAL_GPIO_WritePin, HAL_GPIO_TogglePin, HAL_GPIO_ReadPin
PA0 set, clear and toggle read back 1, 0, 1; read after a 100 us wait matched the written level.
Self-test calls: HAL_GPIO_EXTI_Callback, HAL_GPIO_Init with GPIO_MODE_IT_RISING, HAL_NVIC_EnableIRQ
Five rising edges on PA0 made five callbacks.
Self-test calls: HAL_GetTick, HAL_Delay
HAL_Delay(100) took 101 ticks.
Self-test calls: HAL_UART_Transmit, HAL_UART_Receive, HAL_UART_Init
4 bytes out and back in loopback, status 0.
Self-test calls: HAL_UART_Transmit_IT, HAL_UART_Receive_IT
Tx callback 1, 8 bytes sent; 8 bytes in loopback, callback 1, data equal.
Self-test calls: HAL_UART_Transmit_DMA, HAL_UART_Receive_DMA
DMA transmit of 1, 4, 5, 8 and 16 bytes came back byte for byte through the UART loopback, one callback each; after an interrupt transfer, DMA receive of 8 bytes equal, and of 1, 4, 5 and 16 bytes equal; the same test goes red (stale first byte) with the fix compiled out.
Self-test calls: HAL_I2C_Init, HAL_I2C_Master_Transmit, HAL_I2C_GetError
No device on the bus: HAL_ERROR with error 4 (NACK) at 0 ms with the internal pull-ups on; a device answering is not recorded; afiskon/stm32-ssd1306 builds against it and calls Mem_Write; the display was not attached.
Self-test calls: HAL_SPI_Init, HAL_SPI_TransmitReceive
16 of 16 bytes equal.
Self-test calls: HAL_ADC_Init, HAL_ADC_ConfigChannel, HAL_ADC_Start, HAL_ADC_PollForConversion, HAL_ADC_GetValue
Converted eight times with the pin unwired; all eight read 0, so the conversion path completes but no value was checked.
Self-test calls: HAL_TIM_Base_Start_IT, HAL_TIM_PeriodElapsedCallback, __HAL_TIM_SET_COMPARE, __HAL_TIM_GET_COMPARE, HAL_TIM_PWM_ConfigChannel, HAL_TIM_PWM_Init, HAL_TIM_Base_Init, HAL_TIM_PWM_Start, HAL_TIM_PWM_Stop
10 callbacks in 1050 ms for a 100 ms period; counter-side check: pulse 250 of 1000 gave 25.6 percent, pulse 750 gave 74.3 percent; the pad level was not read.
Self-test calls: HAL_FLASHEx_Erase, HAL_FLASH_Lock, HAL_FLASH_Program, HAL_FLASH_Unlock
Page 124 erased and read blank; 0x1122334455667788 programmed and read back.
Self-test calls: HAL_IWDG_Init, HAL_IWDG_Refresh
Alive after 1.2 s of 200 ms refreshes; reset cause WWDT0 after refreshing stopped.
WorksShould work
Run the commands from the top of the repository folder. A copy of the repository is on GitHub (link at the end of this page).
Keep your ST source files. Delete the *_it.c interrupt handlers (the shim owns GROUP1_IRQHandler, UART0_IRQHandler, TIMG0_IRQHandler and DMA_IRQHandler), the HAL_*_MspInit functions and SystemClock_Config. The clock stays at SysConfig's 32 MHz default.
At the top of main, call the SysConfig start-up first, then the HAL. A one-module SysConfig file is enough: portability/shim/stm32hal_on_mspm0/test/selftest.syscfg.
SYSCFG_DL_init();
HAL_Init();The script force-includes stm32_hal_mspm0.h and supplies stm32g0xx_hal.h, stm32f4xx_hal.h, stm32l4xx_hal.h and the other family header names.
OUT=$PWD/out portability/shim/stm32hal_on_mspm0/build.sh <name> <file.syscfg> <your .c files> [-I<dir>]Back the LaunchPad kit up first, then check the image before you flash it. python3 tools/frl/frl.py detect lists the probe serial; the console is the board's serial port: on a Mac the /dev/cu.usbmodem port whose name ends in 1, on Linux /dev/ttyACM0, on Windows the COM port named “XDS110 Class Application/User UART” (per-system table). The script and its capture were run on a Mac only. The script flashes, captures the backchannel UART (115200 8N1) for 22 seconds into run.log and prints it. Each check prints one PASS or SKIP line.
python3 tools/frl/frl.py backup --board mspm0g3507
python3 tools/preflight_image.py mspm0g3507 <image.out>
PROBE=<your probe serial> CONSOLE=<your serial port> portability/shim/stm32hal_on_mspm0/run.sh out/<name>/<name>.out run.log 22The handle types keep ST's field names. The instances map to what the LaunchPad kit wires out. For another board, change the pin lines in stm32_hal_mspm0.c.
| Your STM32 instance | On the MSPM0G3507 | Pads and header pins | Note |
|---|---|---|---|
| USART1 | UART0 | PA10 (TX), PA11 (RX) | The LaunchPad backchannel to your computer; no wire to the header. |
| I2C1 | I2C1 | J1 pin 9 (PB2, SCL), J1 pin 10 (PB3, SDA) | Power a device from J1 pin 1 (3V3) and J2 pin 20 (GND). The shim turns on the internal pull-ups; use outside 4.7 kOhm pull-ups for real work. |
| SPI1 | SPI1 | PB9 (SCLK), PB8 (PICO), PB7 (POCI) | Chip select is a GPIO you drive. |
| ADC1, channels 0 to 3 | ADC0 | PA27, PA26, PA25, PA24 | Only these four channels are routed. PA27 and PA26 are also the PWM pins below: use one function at a time. |
| TIM1 and TIM3 | TIMG7 | PA26 (channel 1), PA27 (channel 2) | PWM output. TIM1 and TIM3 are the same timer here, so a project that uses both conflicts. PA26 and PA27 are also ADC channels 1 and 0. |
| TIM6 | TIMG0 | none | Periodic interrupt only. |
afiskon/stm32-ssd1306 (MIT) drives an SSD1306 OLED through HAL_I2C_Mem_Write. It builds with none of its 1,907 lines changed: 15.7 kB of flash and 1.7 kB of RAM. With no display attached it ran: the probe at 0x3C came back NACK (error 4) and 50 frames of the loop completed (ports/stm32-hal-shim/ssd1306/logs/ssd1306-nodisplay.log). That proves the call path and the error path, not pixels, so this row stays at Should work until a display is wired.
HAL_I2C_Master_Transmit returns HAL_TIMEOUT instead of an error on an empty busWithout pull-ups the START cannot finish. The shim turns on the internal pull-ups, which gives an immediate NACK error; use outside 4.7 kOhm pull-ups for real work.__HAL_TIM_SET_COMPARE, never the register.FLASH_PAGE_SIZE is 1024A literal 2048 from a G0 project erases two pages and the program afterwards lands in the wrong one.HAL_UART_Receive_IT before the sender starts.HAL_IncTick in your _it.c and the shim's own SysTick count twiceKeep one.Each of these has an entry with the symptom, the cause and the fix in the LP-MSPM0G3507 FAQ.
Only UART0, I2C1, SPI1, ADC0 channels 0 to 3, TIMG7 and TIMG0 are routed. The shim is a way to get an existing project running on the kit, not a library to build a product on. Other STM32 routes:
Checked 2026-11-12 with MSPM0 SDK 2.11.00.07, SysConfig 1.28.0 and TI Arm Clang 5.1.1.LTS on one MSPM0 G3507. The table has every HAL call, the TI call that answers it, what differs and the run that checked it.