Getting error in my custom board related to arduino.h library path

name=custom board
version=1.0.0

compiler.pt32.extra_include=-I{C:\Users\komal.int70\AppData\Local\Arduino15\packages\custom\hardware\arm\1.0.0\core\my_core}/my_core -I{C:\Users\komal.int70\AppData\Local\Arduino15\packages\custom\hardware\arm\1.0.0\core\my_core}/my_core

compiler.warning_flags=-w
compiler.warning_flags.none=-w

compiler.optimization_flags=-Og -g

compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/

compiler.S.cmd=arm-none-eabi-gcc
compiler.c.cmd=arm-none-eabi-gcc
compiler.cpp.cmd=arm-none-eabi-g++
compiler.ar.cmd=arm-none-eabi-gcc-ar
compiler.c.elf.cmd=arm-none-eabi-gcc
compiler.objcopy.cmd=arm-none-eabi-objcopy
compiler.elf2hex.cmd=arm-none-eabi-objcopy

compiler.cpp.std=gnu17

compiler.S.flags={compiler.extra_flags} -c -x assembler-with-cpp {compiler.stm.extra_include}

compiler.c.flags={compiler.extra_flags} -c {compiler.optimization_flags} {compiler.warning_flags} -std={compiler.c.std} -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -MMD {compiler.stm.extra_include}

compiler.cpp.flags={compiler.extra_flags} -c {compiler.optimization_flags} {compiler.warning_flags} -std={compiler.cpp.std} -ffunction-sections -fdata-sections -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.stm.extra_include}

These can be overridden in boards.txt

build.st_extra_flags=
build.extra_flags=
build.bootloader_flags=
build.ldscript=ldscript.ld
build.variant_h=variant_generic.h

compiler.c.st_extra_flags={build.peripheral_pins}
compiler.c.std=gnu17
compiler.cpp.std=gnu++11
compiler.S.st_extra_flags={build.startup_file}

compiler.arm.cmsis.c.flags="-IC:\Users\komal.int70\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0\CMSIS\Include" "-I{C:\Users\komal.int70\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL}"

Specify defaults for vid/pid

build.vid=0
build.pid=-1

Build information's

build.info.flags=-D{build.series} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DBOARD_NAME="{build.board}" -DVARIANT_H="{build.variant_h}"

Defaults config

build.xSerial=-DHAL_UART_MODULE_ENABLED
build.flags.optimize=-Os
build.flags.debug=-DNDEBUG
build.flags.ldspecs=--specs=nano.specs

Compile patterns

---------------------

Compile c files

recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.info.flags} {compiler.c.st_extra_flags} {compiler.c.extra_flags} {build.st_extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"

Compile c++ files

recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {build.info.flags} {compiler.cpp.extra_flags} {build.st_extra_flags} {build.extra_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}"

this my platform.txt file and i'm getting error which i have mention below is the error i'm facing
:0:1: error: macro names must be identifiers
C:\Users\komal.int70\AppData\Local\Temp\arduino\sketches\3FBF1BA18EF95D3BB2E0F72EB1CE272F\sketch\sketch_mar29a.ino.cpp:1:10: fatal error: Arduino.h: No such file or directory
#include <Arduino.h>
^~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

The string in the {..} braces should be a parameter name containung a path and not a path itself.

It seems to me your issue has to do with an attempt to use a custom board added to the platform.txt file.

Not sure why you would need something like this. I suggest you use a standard board library that matches the processor and speed your board is using.

Assuming a new unused processor chip, you will have to program via ISP. You could just program with your project code. Or find a boot program with your clock speed.

I'll add a little bit of additional information to what @b707 said:

The platform.txt file defines templates that are used to generate the commands to compile and upload sketches when a board of the platform is selected in the Arduino development tools.

The braces are special syntax that tells the platform framework to replace it with the value of the property (referred to as "expanding").

So if you have something like this:

foo=Hello
recipe.cpp.o.pattern=echo "{foo} world!"

This will result in the following command being invoked when you compile a sketch:

echo "Hello world!"

You can define properties with any arbitrary name in the platform configuration files, as I did with the foo property in my example. You can reference properties defined in another configuration file (e.g., boards.txt. The platform framework also automatically defines some properties, which are documented in the Arduino Platform Specification:

https://arduino.github.io/arduino-cli/latest/platform-specification/

For example:

{build.core.path}: The path to the selected board's core folder (inside the core platform, for example hardware/arduino/avr/core/arduino)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.