Currently I am adding a new table for Marlin but I am getting an error that the new table for Marlin is not found and it is not compiling for me.
Have you guys encountered this error before and is there any way that can help me compile it?
I have attached some pictures
The error does not come from any .h or .cpp file modifications but from the
platformio.ini. You state
board = MIX_COLOR_VN_V1_0 in it. So, there must be the board definition JSON file for it somewhere, expected to be called
MIX_COLOR_VN_V1_0.json. The error indicates there is none.
Marlin by-default adds Marlin/buildroot/share/PlatformIO/boards at 2.0.x · MarlinFirmware/Marlin · GitHub to the “board definition search path” so to say via
so this is where naturally all custom board JSON files are being stored.
Part 2 is the STM32Duino variant for the board. Now Marlin is really advanced here and uses an extra script for
generate_generic_variant.py to do this on-the-fly.
Read the script carefully. You will find that what it does is
Determine which variant folder to copy from Marlin/buildroot/share/PlatformIO/variants at 2.0.x · MarlinFirmware/Marlin · GitHub to the framework’s variant dir. And in there, I don’t see any
MIX_COLOR_VN_V1_0 folder that would define a custom variant for this board, so you’re probably missing that too.
Initially it seems like there are two paths here.
- Instead of using custom board definitions and variants, try to work with the already existing board definitions and Arduino varaints. From the
STM32F407IXmacro your target chip is partly clear. For that series, PlatformIO only has the genericSTM32F407IGT6 board definition However, you will see in that link that PlatformIO doesn’t declare the board to be compatible with the Arduino framework – this is in this case incorrect and an oversight on the PlatformIO side. Starting at STM32Duino v2.0.0, there is a STM32F4xx/F407I(E-G)(H-T)_F417I(E-G)(H-T) variant folder that would apply to this chip and Arduino-enable it, it just isn’t declared as
variantin the board’s JSON file, genericSTM32F407IGT6.json. So custom modification is necessary anyways which leads to…
- using custom board definitions and Arduino variant. You should start by copying the above referenced JSON file as
buildroot/share/PlatformIO/boardsfolder and make adjustments to it, specifically,
- expand the
"frameworks"array to contain
- in the
"build"section, add a new attribute with
"variant": "MIX_COLOR_VN_V1_0"(the name for the variant folder can be arbitrary but for simplicity should match the board file name)
- correct the
"maximum_size" to the correct values if your MCU is not exactly a
- expand the
- then, go to Marlin’s
buildroot/share/PlatformIO/variantsfolder and create the variant folder there, named
MIX_COLOR_VN_V1_0as declared before. You can grab the STM32F4xx/F407I(E-G)(H-T)_F417I(E-G)(H-T) files from STM32Duino 2.0.0 as a starting point and put them in that folder. Note that these are the files for 2.0.0 but Marlin, through declaring that an older ststm32 platform is used uses STM32Duino 1.9.0. In STM32Duino 1.9.0 there wasn’t a variant for the STM32F407IG yet (available variants) and the filenames and file contents may be slightly different from 2.0.0 and 1.9.0, so you’ll have to play aroud with them a little. A modification that definitely seems to be necessary is renaming
variant.h/cpp. You should also make sure to define a clock initialization function
SystemClock_Config()that matches your board’s hardware (e.g., use HSE=8MHz with PLL to get to 168MHz, make sure the USB clocks are correct so that USB will work). That can be done as documented in the STM32Duino Wiki with STM32CubeMX. I’m sure you will also have to edit default pin settings in the
variant.hfor e.g. I2C, Serial etc…
Doing that should give you the board definition file so that there is no “unknown ID” error anymore, the Arduino variant is then needed to actually support the board in STM32Duino.
Many thanks for your help I will look into this issue again now