Problem with mbed and the STM32L432KC

I’ve been trying to program the STM32L432 Nucleo-32 board using the mbed compiler. It has not been working. I can program a range of other boards without any problem. I noticed that the programming LED did not change when I tried to program the device and remembered that I had seen this before. The problem seems to be as follows:
When you load a program on to an MBED enabled Nucleo-32 board the firmware in the loader checks to see if the first 32 bit word (which will form the initial stack pointer) lies within the available RAM on the target. The value output by the mbed compiler for the L432KC is 0x20010000 – the top of the 64kB of RAM. This should be ok (you would think) however it is rejected by the loader. Using a hex editor I changed the first word to 0x2000C000 (the top of a 48 kB block of SRAM1) and it worked.
So, either there is a bug with the mbed linker script and/or initialization files or the loader on the Nucleo board is misinterpreting the available RAM.
Anyway, I’ve posted this as a bug(/fix) to mbed and will see what happens.

Update: There is updated firmware for the STM32L432 Nucleo board over here: It fixes this problem and the board accepts an initial stack pointer that lies within SRAM2 now.

2 thoughts on “Problem with mbed and the STM32L432KC

  1. Tamas Butuza November 13, 2017 / 3:45 pm

    Hello, Actually I did not use STM32L432, but I see similar problem wit other STM32 as well.
    The total 64k SRAM is divided into two blocks: 48k standard sram, and 16k Core Coupled sram.
    This second part (core coupled sram = ccm) might need extra initialization steps before use. Also, at power up, you can use only the first 48k block, then switch on the ccm ram, and place the stack to this area manually at runtime. The ccm ram is faster, therefore it is perfect place for the stack.
    In the linker scipt, the two ram blocks should be defined ast two distinct regions. The initial stack pointer should be placed at the top of the first (48k) block in the linker script.
    I’m not sure if it helps, but I also had similar problems with use of ccm ram.


    • fduignan November 13, 2017 / 8:53 pm

      Tamas, thanks for the reply. As it turns out, ST rolled out a patch in September to address this problem (available here: The patch upgrade the ST-Link firmware in the nucleo board and it now allows an initial stack pointer that lies within the second SRAM bank.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s