Custom target for STM32F407ZGT6

Hello All,

I’m struggling trying to create a custom target for my developped board.

The situation : I’m hardware designer and have designed a custom board with STM32F407ZGT6, STLINK connected to UART2 (PD5/PD6), ethernet PHY LAN8720 connected to RMII (see schematic). I’m also using analog in for temperature and Interrupt in for user button.

I have found no compatible target equiped with my MCU and after some googling, I understand that I need to create a custom target based for example on DISCO-F407VG (who is mbed os 5 compatible and have same frequency as mine)… Correct me if I’m wrong.

I don’t undestand how to secify in the custon_target.JSON that

  • The PHY is routed as in my schematics

  • The USART2 is used for printf (debugging)

Hello,

I do not think you need to use Mbed OS 5 because of DISCO-F407VG. Since it is not supported in MbedOs 6+ but STm32F4 family is and you will need your own settings anyway.

  • The PHY

There were a topic about something like that - EthernetInterface in mbed OS5 with lan8720 - Mbed OS - Arm Mbed OS support forum, in that discusion is a link to JojoS62/custom_targets: Custom target definitions for Mbed5 (github.com)- So maybe @JojoS can give you some hints.

  • The USART2 is used for printf (debugging)

This settings can be override via mbed_app.json file when you inherit an existing target or you can set your own when you crate your own PinNames.h file.

BR, Jan

Thanks @JohnnyK for your reply.

You are right, I’ve better go for mbed os6+ as you mentioned.

Ok for PHY and UART2, I think these points will no longer be an issue when I’ll get my custom target…

Hope @JojoS could help with some guidance on this. Meantime, I’ll try myself following the mbed documentation.

Thanks.

BTW just for sure if you haven’t seen this - mbed-os/targets/TARGET_STM at master · mbed-ce/mbed-os (github.com)

BR, Jan

1 Like

Hello,

I follow the instructions for custom target creation, but I have an error in Mbed studio while trying to compile a simple program for my custom target just created.

Mbed studio 1.4.4
image

Stlink V3 set

Link to custom target :
https://github.com/djadostyle/custom_stm32f407zg.git

ERROR
Traceback (most recent call last):
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 155, in target
resolution_order = get_resolution_order(json_data, name, )
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 143, in get_resolution_order
order = get_resolution_order(json_data, par, order, level + 1)
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 141, in get_resolution_order
parents = json_data[target_name].get(“inherits”, )
KeyError: ‘MCU_STM32F407xG’
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg/mbed-os/tools/make.py”, line 412, in
main()
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg/mbed-os/tools/make.py”, line 309, in main
mcu = extract_mcus(parser, options)[0]
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\options.py”, line 146, in extract_mcus
update_target_data()
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 814, in update_target_data
in Target.get_json_target_data().items()
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 815, in
if obj.get(“public”, True)]
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 111, in wrapper
CACHES[(func.name, args)] = func(*args, **kwargs)
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 366, in get_target
return target(target_name, Target.get_json_target_data())
File “d:\OneDrive - Penja’s Pearls\Bureau\custom_stm32f407zg\mbed-os\tools\targets_init_.py”, line 159, in target
), exc)
File “c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\future\utils_init_.py”, line 403, in raise_from
exec(execstr, myglobals, mylocals)
File “”, line 1, in
tools.utils.NotSupportedException: target INRUSH_MCU_F407ZG has an incomplete target definition

Any help is appreciated

Thanks

target INRUSH_MCU_F407ZG has an incomplete target definition

Some settings are not correct probably

Your repo is probably private, because I do not see any repository - djadostyle (djadostyle) / Repositories (github.com).

BR, Jan

Sorry, the repo is now public.

After some improvements, I got new error :

The previous error was cause because you inherited a target what does not exist in targets.json. It was STM32F407xG and you changed it to STM32F407xE I suppouse.

The last error is caused by your folder name, it must be TARGET_INRUSH_MCU_F407ZG because that coresponding to the name in your custom_targets.json file.

BR, Jan