Editing framework files

Arduino Due project. I am trying to utilize the UART interrupt, which gets taken in various places in the Arduino core framework files. Thus, I have copied the framework files to my /lib/ directory and edited the necessary ones. However, when I try to include those libraries, it still includes the ones from my .platformio/packages directory.

Here is my platformio.ini:

[env:due]
platform = atmelsam
board = dueUSB
framework = arduino
lib_deps=
    pololu/LSM6@^2.0.1
    pololu/LIS3MDL@^2.0.0
monitor_speed = 9600
lib_extra_dirs = lib
lib_ignore = framework-arduino-sam
build_flags = -ILib/lib/custom-arduino-framework/variants/arduino_due_x, 
                -ILib/lib/custom-arduino-framework/cores/arduino,
                -ILib/lib/custom-arduino-framework/libraries/SPI/src,
                -ILib/lib/custom-arduino-framework/libraries/Wire/src,
                -I lib

Here is a screenshot of my directory structure:
image

I have tried the following, neither of which worked.

#include "Arduino.h"

pulls from /.platformio/packages.

#include "/lib/custom-arduino-framework/Arduino.h"

cannot be found.

Interestingly, a file that I created and does not have a naming conflict with anything in the original packages directory includes just fine:

#include "custom_uart_handler.h"

image

I have since tried to use the platform_packages flag as follows:

[env:due]
platform = atmelsam
board = dueUSB
framework = arduino
lib_deps=
    pololu/LSM6@^2.0.1
    pololu/LIS3MDL@^2.0.0
monitor_speed = 9600
platform_packages = framework-arduino-sam @ https://github.com/swallace23/framework-arduino-sam
build_flags = 
  -I"$PROJECT_PACKAGES_DIR/framework-arduino-sam"

Unfortunately, when I do this, I cannot get any code to run on the board, not even a simple Serial.print(“hello world”);

But, I am not sure that my syntax here is correct.

If this isn’t a typo in your posting this is not a valid include-directive. Syntax for valid includes is described here

Assuming you’re running under some kind of *nix this would try to include a file from /lib/custom-arduino-framework/ - not from the lib-folder inside of your project, due to the leading /

The first one was a typo in posting, which I will now edit.

The solution to this that I found on my own:

Working platformio.ini:

[env:due]
platform = atmelsam
board = dueUSB
framework = arduino
lib_deps=
    pololu/LSM6@^2.0.1
    pololu/LIS3MDL@^2.0.0
monitor_speed = 9600
platform_packages = framework-arduino-sam @ https://github.com/swallace23/framework-arduino-sam.git

The repo is public for anyone who is interested in this solution.