PLease give me a CLEAR and simple include path

Thanks platformIO for making things complex and creating explaining text that does not explain anything

I know I should keep it simple and include all my code limited to 1 single project

You can add folders to the workspace as much as you want they disapear in thin mist …
You can erase .vscode as much as you want nothing can be included how should he know where from

please for include per libarary give me a means to add a library xxxxx> a.h;b.h,c.h a.cpp b.cpp c.cpp
located SOMEWHERE (MY choice!!!) in MY DISK
and allow me to add the path of XXXXX to the include path so that include path not found DISAPEARS FOREVER
so that library path not found DISAPEARS for ever
and I’m able to add XXXXX ,YYYYY “LYBRARY ENTITIES” to my different PROJECTS
without being blocked for a whole week… it is 2020 tme for amaturisme is FINISHED

2 Likes

Ok, I think in the middle of all that I see you ignored the message that the top of c_cpp_properties.json… which told you changes to the file would be lost…

… meaning now would be a good time to read the documentation linked … Redirecting... … specifically the -Idir flag since you want to add to the include path.

Folders added to workspaces aren’t ‘just disappearing’… you’re doing something without realising it… perhaps opening a new window, which is also a new ‘empty’ workspace, or something simple like that, which then throws you because you don’t know why the workspace is now empty.

1 Like

Check out what I do, maybe it will help (All my custom dependencies that I use on many projects are in .lib and its in the same directory as all my project folders):

platformio.ini

;PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env]
platform = atmelavr
framework = arduino

lib_extra_dirs = ../.lib
lib_deps = 
  EasyButton
  ResponsiveAnalogRead

[env:ATmega328PB]
board = ATmega328PB

upload_protocol = usbtiny
upload_flags =
  ;-v
  -e  ;For some reason this MCU has a verification error unless completely erased before every upload
  -b 1000000
  ;-Ulfuse:w:0xFF:m
  ;-Uhfuse:w:0xDF:m ;wdt off
  ;-Uhfuse:w:0xCF:m ;wdt on
  ;-Uefuse:w:0xFF:m

Hope it helps bud!

1 Like

I understand clearly that automatic links mess up with spcified jsons that need to be erased once and a while … Standard product environmenst clash with global settings at project level (platform.ini)… as a result NOTHING WORKS, errors all over that jou need to ignore or not …

No wonder with 1000 answers all pulling you in 9999 directions …

Having an include path is a RIGHT not a LIFE study
PLease explain in simple correct terms without jumping all over the word…

INCLUDE PATHS IS SIMPLE !!!??? Allow me to BLOCK ALL stupid automation
PLease explain . Do not insult me by saying this is DIFFICULT

1 Like

What is “DIFFICULT” about reading the linked documentation about how to use build_flags = -Idir to specify your include directories in addition to those that MUST be declared automatically to meet toolchain dependency requirements?

3 Likes

Hello,

I recently started to work with a nRF52-DK board and I meet an include issue. I already has a successfully based on the PlatformIO Tuto here but when I try to implement a time based serial logger as in the Nordic docs examples (see nRF5_SDK_16.0.0_98a08e2>peripheral>timer) I get an error :

#include <stdbool.h> //OK
#include <stdint.h> //OK
#include "nrf.h" //OK
#include "nrf_drv_timer.h" //NOK (even with <>, and file is well here : Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy/nrf_drv_timer.h)
#include <bsp.h>          //NOK (even with <>, and file is well here : /Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/components/libraries/bsp/bsp.h)
#include <app_error.h>    //NOK (even with <>, and file is well here : /Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/components/libraries/util/app_error.h) 

According to platformIO Documentation I tried to add the following to my PlatformIO.ini

build_flags=
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy/
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/components/libraries/

But nothing seems to work.

I then tried explicit add with

build_flags=
    ...
    -include/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy/nrf_drv_timer.h

that worked this this the first include but not for it’ local dependencies…

As it looks like a config error, here is the summup then full configs :

Summup

[env:nordicnrf52]
build_flags=
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/components/libraries/util
lib_deps =
    Wire
    SPI
framework = arduino
platform = nordicnrf52
board = nrf52_dk
debug_tool = jlink
monitor_speed = 115200

Full

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

;[env:nanoatmega328]
;platform = atmelavr
;board = nanoatmega328
;framework = arduino
;monitor_speed = 115200
;upload_port = /dev/cu.wchusbserial1420
;monitor_port = /dev/cu.wchusbserial1420
;lib_deps =
;    Wire
;    SPI
; ;   gpio_expander

[env:nordicnrf52]
build_flags=
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy
    -I/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/components/libraries/util
    ;-include/Users/pierrejuliencazaux/Documents/nRF5_SDK_16.0.0_98a08e2/integration/nrfx/legacy/nrf_drv_timer.h
lib_deps =
    Wire
    SPI
;    gpio_expander
framework = arduino
platform = nordicnrf52
board = nrf52_dk
debug_tool = jlink
monitor_speed = 115200 

Thank you in advance

Well, nrf_drv_timer.h is not available in the Arduino framework (nRF5) for your board (search query here). You are attempting to use nRF SDK code in a framework which does not have these headers. That won’t work.

PlatformIO uses self-contained framework and toolchain folders (saved in /Users/<user>/.platformio/packages), it will not search your computer for a possible nRF5 SDK to use header files from. The correct way to reusably add more headers and code is via self-contained library.

Partially including one header file but not its dependencies will be tricky, because now you’re trying to integrate two frameworks (nRF5_SDK and the nRF5 Arduino core) together. That can work, you just have to put the header files and implementation files and dependencies into your projects source folder, or a library.

Other Arduino core implementations for the nRF52 are based more directly on the nRF52 SDK – like the Adafruit version. It contains nrfx_timer.h. Sadly though it doesn’t support the nRF52-DK board as a variant – maybe an existing one with the same SoC can be used for your board?

The ‘nRF5’ core does however have the low-level definitions for NRF_TIMER0/1/2 if you want to work with that.

Of course the best thing would be if you compile your nRF5 SDK examples within the nRF5 SDK framework itself – PIO doesn’t yet support the nRF5 SDK as a framework option though yet. GitHub - platformio/platform-nordicnrf52: Nordic nRF52: development platform for PlatformIO is a place for feature requests.

2 Likes

Thank a lot for your answer :slight_smile: Since I’m a noob in all of this I’ll need some time to be 100% clear on all these points ^^


First,

You are attempting to use nRF SDK code in a framework which does not have these headers. That won’t work.

Maybe I’m totally wrong but what I intend to do is to use the tools provided by the SDK in a code style I’m more experienced with (Arduino framework). So I’m trying to include the headers :slight_smile:

I already tried to include the headers both in SRC / LIB / INCLUDE folders without success… As the whole SDK is still into the SRC folder, while I was struggling I finally tried this that removed the includes errors :

build_flags=
    -Isrc/nRF5_SDK_16.0.0_98a08e2/**

Do you think I am on a way for a kind of solution ? Build still fails on this :

src/nRF5_SDK_16.0.0_98a08e2/components/802_15_4/src/rng_entity.c:43:10: fatal error: nrf_rng.h: No such file or directory

But the file is here… the SDK includes the file like this

#include "nrf_rng.h"

and not like this

#include <nrf_rng.h>

that goes on step further, but again, I’m about to micro change the whole SDK for maybe nothing so I prefer share my issue :upside_down_face: This is frustrating ^^ and I hope I’m somehow close ^^


On another hand

The correct way to reusably add more headers and code is via self-contained [library].
[…]
Of course the best thing would be if you compile your nRF5 SDK examples within the nRF5 SDK framework itself – PIO doesn’t yet support the nRF5 SDK as a framework option though yet. [github>platformio>platform-nordicnrf52] is a place for feature requests.

I’ll consider this soon :slight_smile: thx.

As I’m in a transition from Arduino code, I would also love not to rewrite all my code, but I know maybe I’m over expecting things to work auto-magically ^^ As alternatives, I don’t find how to see if the other frameworks (“mbed”, “zephyr”) supports nRF5_SDK_16.0.0_98a08e2. Any clue ?


Finally,

The ‘nRF5’ core does however have the low-level definitions for [ NRF_TIMER0/1/2 ] if you want to work with that.

The timer was for me the first step of way more complex tasks I’d like to perform. I rather prefer to set something to fit the examples.


Thank you for all your insights :slight_smile:

1 Like

The platformio documentation on this topic is horrible. I’ve not seen a single example showing how to include files from the local disk. Unless they fix or clearly document this BASIC need, I give up on platformio. God only knows how many hours of developer time has been wasted on this. The internet is loaded with people asking how to fix this. No clear answers are found anywhere. This should clearly explained on Page 1 of “getting started.”

I’m maybe not following correctly, but, if I need to include a directory on a compilation, not using PlatformIO, I pass -I/path/to/be/added to my compiler command line/makefile.

In a PlatformIO project, I do the same thing in the platformio.ini file by adding:

build_flags = 
    -I/path/to/be/added

And it works.

Build-flags is documented at build_flags — PlatformIO latest documentation where you are also pointed to the gcc docs for compiler options as well as documenting the -I option in the table of possible flags.

HTH

Cheers,
Norm.

build_flags = -I./xxx/xxx/xxx

where . is the directory where your "platform.ini" is at.

This is actually a gcc command.