Arm Mbed OS support forum



I’m working on a port for the NUCLEO-G431KB board from ST, and plan on contributing it to Mbed OS.

I wanted to verify whether there is someone else also working on such a port, or if there is someone willing to do some additional beta testing of my port.

1 Like

The fork is tracked on github here:

The current state is that the NUCLEO-G431KB boots and runs a simple “Blinky” application.

There is a workaround in place (Using HSI instead of HSE), which I plan to fix.
Then also testing of functionality and stability.

Good work!
Why don’t you push to mbed-os repo your PR in order to start an official review ?


Will do! Working on it but got caught up in another urgent issue.

I actually had some issues running “mbed test” so I need to solve that. I’ve understood that according to the process ( that’s a requirement for a “target update” PR to be accepted.


Be sure you have the latest STLink FW:

For mbedls detection tool, you can use this command:
mbedls -m 0851:NUCLEO_G431KB

1 Like


Ah, yeah I updated those now but same issue.
I’m not too familiar with the mbed tools, but it looks like it’s in the serial communication.
(mbedthrun failing to connect).

Who is on the device end of that serial communication? Is it the official ST-Link Firmware, or is it the mbed-os (in my case, compiled with the G431KB profile)?

As it is right now, I’m not sure if the issue is in the G431KB code, the ST-Link Firmware, my mbed installation, or the ST-Link tools I’m using.

Also attaching a dump of what I get when I run “mbed test -t GCC_ARM -m NUCLEO_G431KB -vv -n rtos-tests-tests-mbed_rtos-basic”

Building library mbed-build (NUCLEO_G431KB, GCC_ARM)
Scan: mbed-os-nucleo-g431kb
Building project basic (NUCLEO_G431KB, GCC_ARM)
Scan: basic
Link: basic
Preproc: arm-none-eabi-cpp -E -P BUILD\tests\NUCLEO_G431KB\GCC_ARM\targets\TARGET_STM\TARGET_STM32G4\TARGET_STM32G431xx\TOOLCHAIN_GCC_ARM\stm32g431xx.ld -Wl,–gc-sections -Wl,–wrap,main -Wl,–wrap,_malloc_r -Wl,–wrap,_free_r -Wl,–wrap,_realloc_r -Wl,–wrap,memalign_r -Wl,–wrap,calloc_r -Wl,–wrap,exit -Wl,–wrap,atexit -Wl,-n -Wl,–wrap,printf -Wl,–wrap,sprintf -Wl,–wrap,snprintf -Wl,–wrap,vprintf -Wl,–wrap,vsprintf -Wl,–wrap,vsnprintf -Wl,–wrap,fprintf -Wl,–wrap,vfprintf -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -MMD -fomit-frame-pointer -Os -g -DMBED_TRAP_ERRORS_ENABLED=1 -DMBED_MINIMAL_PRINTF -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -DMBED_ROM_START=0x8000000 -DMBED_ROM_SIZE=0x20000 -DMBED_RAM_START=0x20000000 -DMBED_RAM_SIZE=0x8000 -DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -o .\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic.link_script.ld -DDEVICE_INTERRUPTIN=1 -DTARGET_RTOS_M4_M7 -DDEVICE_SPISLAVE=1 -DDEVICE_RTC=1 -DMBED_TEST_MODE -DTARGET_MCU_STM32G4 -DDEVICE_I2C=1 -DTARGET_LIKE_CORTEX_M4 -DUSE_HAL_DRIVER -DTRANSACTION_QUEUE_SIZE_SPI=2 -DDEVICE_PORTINOUT=1 -DEXTRA_IDLE_STACK_REQUIRED -DDEVICE_FLASH=1 -DDEVICE_LPTICKER=1 -DDEVICE_USTICKER=1 -DDEVICE_SPI=1 -D__CMSIS_RTOS -DDEVICE_STDIO_MESSAGES=1 -DCOMPONENT_FLASHIAP=1 -DDEVICE_SPI_ASYNCH=1 -D__MBED=1 -D__CORTEX_M4 -DDEVICE_SLEEP=1 -DDEVICE_I2C_ASYNCH=1 -DDEVICE_WATCHDOG=1 -DTARGET_FF_MORPHO -DDEVICE_RESET_REASON=1 -DTARGET_CORTEX_M -DARM_MATH_CM4 -DTARGET_STM32G4 -D__FPU_PRESENT=1 -DTARGET_STM -DDEVICE_MPU=1 -DUSE_FULL_LL_DRIVER -DDEVICE_PWMOUT=1 -DDEVICE_CAN=1 -DDEVICE_USBDEVICE=1 -D__MBED_CMSIS_RTOS_CM -DDEVICE_PORTIN=1 -DDEVICE_ANALOGIN=1 -DDEVICE_I2CSLAVE=1 -DTARGET_M4 -DDEVICE_SERIAL_FC=1 -DSTM32G431xx -DTARGET_CORTEX -DSTM32G431KB -DTOOLCHAIN_GCC_ARM -DTARGET_STM32G431KB -DMBED_BUILD_TIMESTAMP=1603545886.4485083 -DTARGET_LIKE_MBED -DMBED_TICKLESS -DTARGET_MCU_STM32 -DTARGET_NUCLEO_G431KB -DTARGET_FF_ARDUINO -DTARGET_STM32G431xx -DDEVICE_ANALOGOUT=1 -DDEVICE_SERIAL=1 -DTOOLCHAIN_GCC -DTARGET_RELEASE -DDEVICE_PORTOUT=1 -DTARGET_NAME=NUCLEO_G431KB @.\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic.includes_d41d8cd98f00b204e9800998ecf8427e.txt -include .\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic\mbed_config.h
[DEBUG] Return: 0
Link: arm-none-eabi-gcc @.\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic.link_options.txt
[DEBUG] Return: 0
Elf2Bin: basic
FromELF: arm-none-eabi-objcopy -O binary .\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic\basic.elf .\BUILD\tests\NUCLEO_G431KB\GCC_ARM.\rtos\tests\TESTS\mbed_rtos\basic\basic.bin
[DEBUG] Return: 0

Module .text .data .bss
[fill] 126(+0) 7(+0) 32(+0)
[lib]\c.a 5836(+0) 2108(+0) 89(+0)
[lib]\gcc.a 760(+0) 0(+0) 0(+0)
[lib]\misc 180(+0) 4(+0) 28(+0)
cmsis\CMSIS_5 7152(+0) 164(+0) 1868(+0)
cmsis\device 986(+0) 4(+0) 4344(+0)
connectivity\drivers 4(+0) 0(+0) 0(+0)
connectivity\nanostack 80(+0) 0(+0) 0(+0)
drivers\source 480(+0) 0(+0) 0(+0)
features\frameworks 4998(+0) 69(+0) 369(+0)
hal\source 1698(+0) 8(+0) 130(+0)
platform\source 5514(+0) 260(+0) 416(+0)
rtos\source 864(+0) 0(+0) 0(+0)
rtos\tests 458(+0) 0(+0) 76(+0)
targets\TARGET_STM 11536(+0) 8(+0) 912(+0)
Subtotals 40672(+0) 2632(+0) 8264(+0)

Total Static RAM memory (data + bss): 10896(+0) bytes
Total Flash memory (text + data): 43304(+0) bytes

Image: BUILD/tests/NUCLEO_G431KB/GCC_ARM/rtos/tests/TESTS/mbed_rtos/basic/basic.bin

Memory map breakdown for built projects (values in Bytes):

name target toolchain static_ram total_flash
basic NUCLEO_G431KB GCC_ARM 10896 43304

Build successes:

    mbedgt: greentea test automation tool ver. 1.7.4
    mbedgt: test specification file ‘.\BUILD\tests\NUCLEO_G431KB\GCC_ARM\test_spec.json’ (specified with --test-spec option)
    mbedgt: using ‘.\BUILD\tests\NUCLEO_G431KB\GCC_ARM\test_spec.json’ from current directory!
    mbedgt: detecting connected mbed-enabled devices…
    mbedgt: detected 1 device
    latform_name platform_name_unique serial_port mount_point target_id
    UCLEO_G431KB NUCLEO_G431KB[0] COM5 E: 08510221114C68682E08F104

mbedgt: processing target ‘NUCLEO_G431KB’ toolchain ‘GCC_ARM’ compatible platforms… (note: switch set to --parallel 1)
| platform_name | platform_name_unique | serial_port | mount_point | target_id |
| NUCLEO_G431KB | NUCLEO_G431KB[0] | COM5:9600 | E: | 08510221114C68682E08F104 |
mbedgt: test case filter (specified with -n option)
test filtered in ‘rtos-tests-tests-mbed_rtos-basic’
mbedgt: running 1 test for platform ‘NUCLEO_G431KB’ and toolchain ‘GCC_ARM’
use 1 instance of execution threads for testing
mbedgt: checking for ‘host_tests’ directory above image directory structure
found ‘host_tests’ directory in: ‘rtos\tests\TESTS\host_tests’
mbedgt: selecting test case observer…
calling mbedhtrun: mbedhtrun -m NUCLEO_G431KB -p COM5:9600 -f “BUILD/tests/NUCLEO_G431KB/GCC_ARM/rtos/tests/TESTS/mbed_rtos/basic/basic.bin” -e “rtos\tests\TESTS\host_tests” -d E: -c default -t 08510221114C68682E08F104 -r default -C 4 --sync 5 -P 60
mbedgt: mbed-host-test-runner: started
[1603545891.41][HTST][INF] host test executor ver. 0.0.15
[1603545891.41][HTST][INF] copy image onto target…
[1603545891.42][COPY][INF] Waiting up to 60 sec for ‘08510221114C68682E08F104’ mount point (current is ‘E:’)…
1 file(s) copied.
[1603545899.49][HTST][INF] starting host test process…
[1603545899.83][CONN][INF] starting connection process…
[1603545899.83][CONN][INF] notify event queue about extra 60 sec timeout for serial port pooling
[1603545899.83][CONN][INF] initializing serial port listener…
[1603545899.83][PLGN][INF] Waiting up to 60 sec for ‘08510221114C68682E08F104’ serial port (current is ‘COM5’)…
[1603545899.83][HTST][INF] setting timeout to: 60 sec
[1603545899.85][SERI][INF] serial(port=COM5, baudrate=9600, read_timeout=0.01, write_timeout=5)
[1603545899.85][SERI][INF] reset device using ‘default’ plugin…
[1603545900.11][SERI][INF] waiting 1.00 sec after reset
[1603545901.13][SERI][INF] wait for it…
[1603545901.13][SERI][TXD] mbedmbedmbedmbedmbedmbedmbedmbedmbedmbed
[1603545901.13][CONN][INF] sending up to 5 __sync packets (specified with --sync=5)
[1603545901.13][CONN][INF] sending preamble ‘1c919629-67be-44af-a495-853ba13cc747’
[1603545901.16][SERI][TXD] {{__sync;1c919629-67be-44af-a495-853ba13cc747}}
[1603545906.16][CONN][INF] Reset the part and send in new preamble…
[1603545906.16][SERI][INF] reset device using ‘default’ plugin…
[1603545906.42][SERI][INF] waiting 1.00 sec after reset
[1603545907.43][SERI][INF] wait for it…
[1603545907.43][CONN][INF] resending new preamble ‘b4c3f2a4-2328-4fde-98a5-7e1f27854210’ after 5.01 sec
[1603545907.43][SERI][TXD] {{__sync;b4c3f2a4-2328-4fde-98a5-7e1f27854210}}
[1603545912.43][CONN][INF] Reset the part and send in new preamble…
[1603545912.43][SERI][INF] reset device using ‘default’ plugin…
[1603545912.68][SERI][INF] waiting 1.00 sec after reset
[1603545913.68][SERI][INF] wait for it…
[1603545913.68][CONN][INF] resending new preamble ‘c484fc9c-3009-4864-98c8-acceb10d83ed’ after 5.00 sec
[1603545913.68][SERI][TXD] {{__sync;c484fc9c-3009-4864-98c8-acceb10d83ed}}
[1603545918.69][CONN][INF] Reset the part and send in new preamble…
[1603545918.69][SERI][INF] reset device using ‘default’ plugin…
[1603545918.94][SERI][INF] waiting 1.00 sec after reset
[1603545919.94][SERI][INF] wait for it…
[1603545919.94][CONN][INF] resending new preamble ‘ef78b7df-2049-4042-821c-f871969dbff5’ after 5.01 sec
[1603545919.94][SERI][TXD] {{__sync;ef78b7df-2049-4042-821c-f871969dbff5}}
[1603545924.94][CONN][INF] Reset the part and send in new preamble…
[1603545924.94][SERI][INF] reset device using ‘default’ plugin…
[1603545925.19][SERI][INF] waiting 1.00 sec after reset
[1603545926.20][SERI][INF] wait for it…
[1603545926.20][CONN][INF] resending new preamble ‘f448d69a-d360-4719-bedb-f1d3ec1e1507’ after 5.00 sec
[1603545926.20][SERI][TXD] {{__sync;f448d69a-d360-4719-bedb-f1d3ec1e1507}}
[1603545926.21][HTST][ERR] None
[1603545926.21][HTST][WRN] stopped to consume events due to __notify_sync_failed event
[1603545926.21][HTST][INF] __exit_event_queue received
[1603545926.21][HTST][INF] test suite run finished after 26.37 sec…
[1603545926.22][HTST][INF] CONN exited with code: 0
[1603545926.22][HTST][INF] No events in queue
[1603545926.22][HTST][INF] host test result() call skipped, received: sync_failed
[1603545926.22][HTST][WRN] missing __exit event from DUT
[1603545926.22][HTST][INF] calling blocking teardown()
[1603545926.22][HTST][INF] teardown() finished
[1603545926.22][HTST][INF] {{result;sync_failed}}
mbedgt: retry mbedhtrun 1/1
mbedgt: [‘mbedhtrun’, ‘-m’, ‘NUCLEO_G431KB’, ‘-p’, ‘COM5:9600’, ‘-f’, ‘“BUILD/tests/NUCLEO_G431KB/GCC_ARM/rtos/tests/TESTS/mbed_rtos/basic/basic.bin”’, ‘-e’, ‘“rtos\tests\TESTS\host_tests”’, ‘-d’, ‘E:’, ‘-c’, ‘default’, ‘-t’, ‘08510221114C68682E08F104’, ‘-r’, ‘default’, ‘-C’, ‘4’, ‘–sync’, ‘5’, ‘-P’, ‘60’] failed after 1 count
mbedgt: checking for GCOV data…
mbedgt: mbed-host-test-runner: stopped and returned ‘SYNC_FAILED’
mbedgt: test case summary event not found
no test case report present, assuming test suite to be a single test case!
test suite: rtos-tests-tests-mbed_rtos-basic
test case: rtos-tests-tests-mbed_rtos-basic
mbedgt: test on hardware with target id: 08510221114C68682E08F104
mbedgt: test suite ‘rtos-tests-tests-mbed_rtos-basic’ … SYNC_FAILED in 35.19 sec
test case: ‘rtos-tests-tests-mbed_rtos-basic’ … ERROR in 35.19 sec
mbedgt: test case summary: 0 passes, 1 failure
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.6402630474
mbedgt: test suite report:

target platform_name test suite result elapsed_time (sec) copy_method
NUCLEO_G431KB-GCC_ARM NUCLEO_G431KB rtos-tests-tests-mbed_rtos-basic SYNC_FAILED 35.19 default

mbedgt: test suite results: 1 SYNC_FAILED
mbedgt: test case report:

target platform_name test suite test case passed failed result elapsed_time (sec)
NUCLEO_G431KB-GCC_ARM NUCLEO_G431KB rtos-tests-tests-mbed_rtos-basic rtos-tests-tests-mbed_rtos-basic 0 1 ERROR 35.19

mbedgt: test case results: 1 ERROR
mbedgt: completed in 35.71 sec
mbedgt: exited with code 1
[mbed-14540] Working path “C:\Users\tauno\mbed-local\try5\mbed-os-nucleo-g431kb” (program)
[mbed-14540] Exec “c:\users\tauno\appdata\local\visualgdb\python3\python.exe -m pip list -l” in “C:\Users\tauno\mbed-local\try5\mbed-os-nucleo-g431kb”
Package Version

appdirs 1.4.4

asn1ate 0.6.0

beautifulsoup4 4.9.1

cbor 1.0.0

certifi 2020.6.20

cffi 1.14.1

chardet 3.0.4

Click 7.0

cmsis-pack-manager 0.2.10

colorama 0.4.3

cryptography 2.9.2

ecdsa 0.15

fasteners 0.15

future 0.18.2

hidapi 0.7.99.post21

icetea 1.2.4

idna 2.10

intelhex 2.2.1

Jinja2 2.10.3

jsonmerge 1.7.0

jsonschema 2.6.0

junit-xml 1.9

lockfile 0.12.2

manifest-tool 1.5.2

MarkupSafe 1.1.1

mbed-cli 1.10.4

mbed-cloud-sdk 2.0.8

mbed-flasher 0.10.1

mbed-greentea 1.7.4

mbed-host-tests 1.5.10

mbed-ls 1.7.12

mbed-os-tools 0.0.15

mercurial 5.3

milksnake 0.1.5

monotonic 1.5

pip 20.2.2

prettytable 0.7.2

protobuf 3.5.2.post1

psutil 5.6.6

pyasn1 0.2.3

pycparser 2.20

pycryptodome 3.9.8

pyelftools 0.25

pyparsing 2.4.7

pyserial 3.4

python-dateutil 2.8.1

python-dotenv 0.14.0

pyusb 1.0.2

pywin32 224

PyYAML 4.2b1

requests 2.24.0

semver 2.10.2

setuptools 40.8.0

six 1.15.0

soupsieve 2.0.1

urllib3 1.25.10

WMI 1.4.9

yattag 1.14.0
[mbed-14540] Exec “c:\users\tauno\appdata\local\visualgdb\python3\python.exe -u C:\Users\tauno\mbed-local\try5\mbed-os-nucleo-g431kb\tools\ -D MBED_TEST_MODE -t GCC_ARM -m NUCLEO_G431KB --source . --build .\BUILD\tests\NUCLEO_G431KB\GCC_ARM --test-spec .\BUILD\tests\NUCLEO_G431KB\GCC_ARM\test_spec.json --build-data .\BUILD\tests\NUCLEO_G431KB\GCC_ARM\build_data.json -n rtos-tests-tests-mbed_rtos-basic -v --greentea” in “C:\Users\tauno\mbed-local\try5\mbed-os-nucleo-g431kb”
[mbed-14540] Exec “mbedgt --test-spec .\BUILD\tests\NUCLEO_G431KB\GCC_ARM\test_spec.json -n rtos-tests-tests-mbed_rtos-basic -V” in “C:\Users\tauno\mbed-local\try5\mbed-os-nucleo-g431kb”


When target and host are not able to sync, you have to check:

  • clock configuration is SetSysClock
  • UART configuration for ST Link virtual COM

You could also start pushing your update into a mbed-os PR,
then official review could start.