PlatformIO Community

Use of platform_package with custom board and Zephyr RTOS

Hi,

I have a project with a Laird board called Pinnacle 100 development kit. They just released support for Zephyr 2.4 that will be announced this month on september 25. But instead of waiting I made a custom .json for the board (pinnacle_100_dvk.json):

{
"build": {
  "cpu": "cortex-m4",
  "f_cpu": "64000000L",
  "mcu": "nrf52840"
},
"connectivity": [
  "cat-m1",
  "nb-iot",
  "lte",
  "bluetooth"
],
"debug": {
  "default_tools": [
    "jlink"
  ],
  "jlink_device": "nRF52840_xxAA",
  "onboard_tools": [
    "cmsis-dap",
    "jlink"
  ],
  "svd_path": "nrf52840.svd"
},
"frameworks": [
  "zephyr"
],
"name": "Pinnacle 100 Development Kit",
"upload": {
  "maximum_ram_size": 262144,
  "maximum_size": 1048576,
  "protocol": "jlink"
},
"url": "https://github.com/LairdCP/zephyr_boards/blob/master/pinnacle_100_dvk/doc/index.rst",
"vendor": "Laird Connectivity"
}

Then, I followed these steps platform_package.
The platformio.ini look like this:

[env:pinnacle_100_dvk]
platform = nordicnrf52
platform_packages = framework-zephyr@https://github.com/is-none/zephyr.git  ;<== this one
board = pinnacle_100_dvk
framework = zephyr

I have a forked repo of Zephyr 2.4.0-rc1 and I added the package.json file:

{
   "description": "A small, scalable open source RTOS for IoT embedded devices",
   "name": "framework-zephyr",
   "url": "https://www.zephyrproject.org/",
   "version": "2.4.0-rc1"
}

Then I got a missing file error, so I added:

/zephyr/scripts/platformio/platformio-build.py
and
/zephyr/scripts/platformio/platformio-build-pre.py

Now, I have these errors:

Building in release mode
Compiling .pio/build/pinnacle_100_dvk/src/main.o
arm-none-eabi-gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files
compilation terminated.
Compiling .pio/build/pinnacle_100_dvk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o
In file included from ~/.platformio/packages/framework-zephyr/include/toolchain.h:41,
                 from ~/.platformio/packages/framework-zephyr/kernel/include/gen_offset.h:74,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:7:
~/.platformio/packages/framework-zephyr/include/toolchain/gcc.h:438:2: error: #error processor architecture not supported
 #error processor architecture not supported
  ^~~~~
In file included from ~/.platformio/packages/framework-zephyr/include/kernel_includes.h:29,
                 from ~/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
~/.platformio/packages/framework-zephyr/include/kernel_structs.h:136:19: error: 'CONFIG_MP_NUM_CPUS' undeclared here (not in a function)
  struct _cpu cpus[CONFIG_MP_NUM_CPUS];
                   ^~~~~~~~~~~~~~~~~~
In file included from ~/.platformio/packages/framework-zephyr/include/kernel_includes.h:38,
                 from ~/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
~/.platformio/packages/framework-zephyr/include/arch/cpu.h:31:2: error: #error "Unknown Architecture"
 #error "Unknown Architecture"
  ^~~~~
In file included from ~/.platformio/packages/framework-zephyr/include/sys_clock.h:25,
                 from ~/.platformio/packages/framework-zephyr/include/kernel_includes.h:40,
                 from ~/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from ~/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
~/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'sys_clock_hw_cycles_per_sec':
~/.platformio/packages/framework-zephyr/include/sys/time_units.h:55:9: error: 'CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC' undeclared (first use in this function); did you mean 'K_SYSCALL_PWM_GET_CYCLES_PER_SEC'?

... and so on

I am not sure if I am missing to import another file, a linker… ???

Your help will be much appreciated.

thx

Looking at https://github.com/is-none/zephyr/blob/master/include/toolchain/gcc.h#L395-L439 it seems its missing the CONFIG_ARM macro here. Maybe add via build_flags = -D CONFIG_ARM? Sounds like a deeper issue with the build scripts though if it couldn’t figure out that that macro must be there…

For that you should compile with pio run -v to see the full compiler invocation and whether the error message is right there. Is -o really used with -c, -S -E with multiple files?

Hey Max,

So I added the missing macro like this:

[env:pinnacle_100_dvk]
platform = nordicnrf52
platform_packages = framework-zephyr@https://github.com/is-none/zephyr.git
board = pinnacle_100_dvk
framework = zephyr
build_flags = -D CONFIG_ARM

but I still have the same errors.

Here’s the full output:

sinan@isnan:~/projects/embedded/Pin1$ pio run -v
Processing pinnacle_100_dvk (platform: nordicnrf52; platform_packages: framework-zephyr@https://github.com/is-none/zephyr.git; board: pinnacle_100_dvk; framework: zephyr; build_flags: -D CONFIG_ARM)
---------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/pinnacle_100_dvk.html
PLATFORM: Nordic nRF52 (4.4.1) > Pinnacle 100 Development Kit
HARDWARE: NRF52840 64MHz, 256KB RAM, 1MB Flash
PACKAGES: 
 - framework-zephyr 2.4.0-rc1+sha.1be29c0 (git+https://github.com/is-none/zephyr.git) 
 - framework-zephyr-canopennode 0.0.0-alpha+sha.5c6b0566d5 
 - framework-zephyr-civetweb 0.0.0-alpha+sha.99129c5efc 
 - framework-zephyr-cmsis 0.0.0-alpha+sha.542b2296e6 
 - framework-zephyr-fatfs 0.0.0-alpha+sha.9ee6b9b951 
 - framework-zephyr-hal-nordic 0.0.0-alpha+sha.742d8fb839 
 - framework-zephyr-libmetal 0.0.0-alpha+sha.3c3c9ec83b 
 - framework-zephyr-littlefs 0.0.0-alpha+sha.0aefdda69d 
 - framework-zephyr-loramac-node 0.0.0-alpha+sha.29e516ec58 
 - framework-zephyr-lvgl 0.0.0-alpha+sha.74fc2e753a 
 - framework-zephyr-mbedtls 0.0.0-alpha+sha.4bf099f125 
 - framework-zephyr-mcuboot 0.0.0-alpha+sha.e88113bbeb 
 - framework-zephyr-mcumgr 0.0.0-alpha+sha.5885efb7ca 
 - framework-zephyr-mipi-sys-t 0.0.0-alpha+sha.957d46bc3c 
 - framework-zephyr-open-amp 0.0.0-alpha+sha.724f7e2a45 
 - framework-zephyr-openthread 0.0.0-alpha+sha.a83d18cf18 
 - framework-zephyr-segger 0.0.0-alpha+sha.6fcf61606d 
 - framework-zephyr-tinycbor 0.0.0-alpha+sha.40daca97b4 
 - framework-zephyr-tinycrypt 0.0.0-alpha+sha.3e9a49d267 
 - framework-zephyr-trusted-firmware-m 0.0.0-alpha+sha.7de2daa196 
 - tool-cmake 3.16.4 
 - tool-dtc 1.4.7 
 - tool-gperf 3.0.4 
 - tool-ninja 1.7.1 
 - tool-sreccat 1.164.0 (1.64) 
 - toolchain-gccarmnoneeabi 1.80201.181220 (8.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
arm-none-eabi-gcc -o .pio/build/pinnacle_100_dvk/src/main.o -c -Os -Wall -Werror=implicit-int -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wno-unused-but-set-variable -Wpointer-arith -fdata-sections -ffreestanding -ffunction-sections -fmacro-prefix-map=/home/sinan/.platformio/packages/framework-zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/sinan/projects/embedded/Pin1/zephyr=CMAKE_SOURCE_DIR -fno-asynchronous-unwind-tables -fno-common -fno-defer-pop -fno-pic -fno-pie -fno-reorder-functions -fno-strict-overflow -g -imacros -mabi=aapcs -mcpu=cortex-m4 -mthumb -nostdinc -std=c99 /home/sinan/.platformio/packages/framework-zephyr/include/toolchain/zephyr_stdint.h /home/sinan/projects/embedded/Pin1/.pio/build/pinnacle_100_dvk/zephyr/include/generated/autoconf.h -isystem /home/sinan/.platformio/packages/framework-zephyr/lib/libc/minimal/include -isystem /home/sinan/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include -isystem /home/sinan/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed -DPLATFORMIO=50001 -DCONFIG_ARM -DBUILD_VERSION=zephyr-v4 -DKERNEL -DNRF52840_XXAA -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -Iinclude -Isrc -I/home/sinan/.platformio/packages/framework-zephyr/include -I.pio/build/pinnacle_100_dvk/zephyr/include/generated -I/home/sinan/.platformio/packages/framework-zephyr/soc/arm/nordic_nrf/nrf52 -I/home/sinan/.platformio/packages/framework-zephyr-segger/rtt -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx/drivers/include -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx/mdk -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic -I/home/sinan/.platformio/packages/framework-zephyr-cmsis/CMSIS/Core/Include -I.pio/build/pinnacle_100_dvk/zephyr/include/generated src/main.c
arm-none-eabi-gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files
compilation terminated.
arm-none-eabi-gcc -o .pio/build/pinnacle_100_dvk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o -c -std=c99 -Os -ffreestanding -fno-common -g -mcpu=cortex-m4 -mthumb -mabi=aapcs -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/sinan/projects/embedded/Pin1/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/sinan/.platformio/packages/framework-zephyr=ZEPHYR_BASE -ffunction-sections -fdata-sections -nostdinc -isystem /home/sinan/.platformio/packages/framework-zephyr/lib/libc/minimal/include -isystem /home/sinan/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include -isystem /home/sinan/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed -DPLATFORMIO=50001 -DCONFIG_ARM -DBUILD_VERSION=zephyr-v4 -DKERNEL -DNRF52840_XXAA -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/sinan/.platformio/packages/framework-zephyr/kernel/include -I/home/sinan/.platformio/packages/framework-zephyr/arch/arm/include -I/home/sinan/.platformio/packages/framework-zephyr/include -I.pio/build/pinnacle_100_dvk/zephyr/include/generated -I/home/sinan/.platformio/packages/framework-zephyr/soc/arm/nordic_nrf/nrf52 -I/home/sinan/.platformio/packages/framework-zephyr-segger/rtt -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx/drivers/include -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic/nrfx/mdk -I/home/sinan/.platformio/packages/framework-zephyr-hal-nordic -I/home/sinan/.platformio/packages/framework-zephyr-cmsis/CMSIS/Core/Include /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c
In file included from /home/sinan/.platformio/packages/framework-zephyr/include/kernel_includes.h:29,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
/home/sinan/.platformio/packages/framework-zephyr/include/kernel_structs.h:136:19: error: 'CONFIG_MP_NUM_CPUS' undeclared here (not in a function)
  struct _cpu cpus[CONFIG_MP_NUM_CPUS];
                   ^~~~~~~~~~~~~~~~~~
In file included from /home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/arch.h:28,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/arch/cpu.h:19,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel_includes.h:38,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
/home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/error.h:59:2: error: #error Unknown ARM architecture
 #error Unknown ARM architecture
  ^~~~~
In file included from /home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/asm_inline.h:18,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/arch.h:33,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/arch/cpu.h:19,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel_includes.h:38,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
/home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/asm_inline_gcc.h: In function 'arch_irq_lock':
/home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/asm_inline_gcc.h:73:2: error: #error Unknown ARM architecture
 #error Unknown ARM architecture
  ^~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/asm_inline_gcc.h: In function 'arch_irq_unlock':
/home/sinan/.platformio/packages/framework-zephyr/include/arch/arm/aarch32/asm_inline_gcc.h:107:2: error: #error Unknown ARM architecture
 #error Unknown ARM architecture
  ^~~~~
In file included from /home/sinan/.platformio/packages/framework-zephyr/include/sys_clock.h:25,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel_includes.h:40,
                 from /home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:17,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets_aarch32.c:28,
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'sys_clock_hw_cycles_per_sec':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:55:9: error: 'CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC' undeclared (first use in this function); did you mean 'K_SYSCALL_PWM_GET_CYCLES_PER_SEC'?
  return CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         K_SYSCALL_PWM_GET_CYCLES_PER_SEC
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:55:9: note: each undeclared identifier is reported only once for each function it appears in
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:301:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, true, false, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:315:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, false, false, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:329:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, true, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:343:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, false, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_ceil32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:357:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, true, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ms_to_ticks_ceil64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:371:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ms, Z_HZ_ticks, true, false, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:469:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, true, false, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:483:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, false, false, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:497:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, true, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:511:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, false, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_ceil32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:525:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, true, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_us_to_ticks_ceil64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:539:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_us, Z_HZ_ticks, true, false, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:637:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, true, false, false);
                             ^~~~~~~~~~
*** [.pio/build/pinnacle_100_dvk/src/main.o] Error 1
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:651:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, false, false, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:665:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, true, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:679:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, false, false, true);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_ceil32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:693:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, true, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ns_to_ticks_ceil64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:707:29: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ns, Z_HZ_ticks, true, false, true, false);
                             ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:973:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false, false);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:987:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false, false);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1001:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, false, true);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1015:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, false, true);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_ceil32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1029:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, true, true, false);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_cyc_to_ticks_ceil64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1043:30: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_cyc, Z_HZ_ticks, Z_CCYC, false, true, false);
                              ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1057:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, true, false, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1071:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, false, false, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1085:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, true, false, true);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1099:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, false, false, true);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_ceil32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1113:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, true, true, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_ms_ceil64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1127:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_ms, true, false, true, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_us_floor32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1141:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_us, true, true, false, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_us_floor64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1155:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_us, true, false, false, false);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_us_near32':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:1169:20: note: in expansion of macro 'Z_HZ_ticks'
  return z_tmcvt(t, Z_HZ_ticks, Z_HZ_us, true, true, false, true);
                    ^~~~~~~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h: In function 'k_ticks_to_us_near64':
/home/sinan/.platformio/packages/framework-zephyr/include/sys/time_units.h:203:20: error: 'CONFIG_SYS_CLOCK_TICKS_PER_SEC' undeclared (first use in this function)
 #define Z_HZ_ticks CONFIG_SYS_CLOCK_TICKS_PER_SEC
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..............................................
 more here, can`t print them all
..............................................
                 from /home/sinan/.platformio/packages/framework-zephyr/arch/arm/core/offsets/offsets.c:12:
/home/sinan/.platformio/packages/framework-zephyr/include/kernel.h: At top level:
/home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:43:2: error: #error "invalid configuration"
 #error "invalid configuration"
  ^~~~~
/home/sinan/.platformio/packages/framework-zephyr/include/kernel.h:59:2: error: #error "invalid configuration"
 #error "invalid configuration"
  ^~~~~
*** [.pio/build/pinnacle_100_dvk/offsets/zephyr/arch/arm/core/offsets/offsets.c.o] Error 1
============================================================== [FAILED] Took 1.93 seconds ==============================================================
sinan@isnan:~/projects/embedded/Pin1$ 

Sorry about print all the output and thanks for helping me out with this !

I had the same issue. Solved it by fixing the framework-zephyr CMake file:
CMake seems to have an issue with repeating command line arguments given to gcc. The

-imacros /whatever/path.h

is given several times in order to force-include e.g. autoconf.h into every compiled .c file.
However, the CMake version of PIO seems to only keep one argument if it detects several identical arguments. I solved it by gluing -imacros together with the .h path, so instead of, e.g.

-imacros /path/to/build/autogenerated/autoconf.h

then becomes

    -imacros/path/to/build/autogenerated/autoconf.h

which doesn’t seem to bother gcc.

FIX:

So I assume you also extracted the framework-zephyr files to another location or you’re trying to fix them in-place (~/.platformio/platforms/packages/framework-zephyr)

In the file CMakeLists.txt in line 203:

zephyr_compile_options($<TARGET_PROPERTY:compiler,imacros> ${AUTOCONF_H})

simply remove the space before the file after the '>.

Same should be done for the second ocasion where this pattern occurs:
CMakeLists.txt line 224:

zephyr_compile_options(-imacros${ZEPHYR_BASE}/include/toolchain/zephyr_stdint.h)

(removed space)

:slight_smile: It happily compiles 2.4 now

Thanks @stefan-elexir !! I will give a try this weekend and let you know. Thanks for sharing your solution :call_me_hand:t3: :call_me_hand:t3:

@stefan-elexir, So yeah it worked! But I had to fork hal_nordic (related to nrf52 mcu) to compile everything without error. Now I can build and flash but I can’t debug:
Error: Currently, PlatformIO does not support debugging for `Pinnacle 100 Development Kit`. And I absolutely need to debug remotely.

I don’t know if it is possible for Platformio to give an approximate date when zephyr 2.4 and this board will be integrated…

thanks anyway

p.s the .ini file end up to look like this:

platform = nordicnrf52
board = pinnacle_100_dvk
framework = zephyr
build_flags = -D CONFIG_ARM
platform_packages =
    framework-zephyr@https://github.com/is-none/zephyr.git
    framework-zephyr-hal-nordic@https://github.com/is-none/hal_nordic.git