Custom Board Not Found

I have created a boards directory in %HOMEPATH%.platformio and created a custom board JSON file in it. When I run platformio boards it is not shown and, of course, doing a build results in a “Unknown board ID” error. I have tried placing the file in the platforms/teensy directory but it is not found here either. I’ve searched for a solution to this problem and implemented everything that was relevant but the custom board is not seen by platofrmio. I also would like to know where to put the ldscript file I reference in the JSON file.

PlatformIO version is: 3.5.3b1 running on Win7 Pro

I also have an Arduino style boards.txt file in .platformio\packages\framework-arduinoteensy that works when I use this board in the Arduino/TeensyDuino IDE

I would appreciate some help on getting this custom board installed and working in PlatformIO.

Here is the JSON file (sorry… I don’t know how to put code in a post or to upload the file as only images are allowed):

{
“teensy3x”: {
“build”: {
“core”: “teensy3”,
“cpu”: “cortex-m4”,
“extra_flags”: “-D__MK20DX256__ -DTEENSY31”,
“f_cpu”: “96000000L”,
“ldscript”: “mk20dx128.ld”,
“mcu”: “mk20dx128”
},
“debug”: {
“jlink_device”: “MK20DX128xxx7”
},
“frameworks”: [
“arduino”
],
“name”: “teensy3x”,
“upload”: {
“maximum_ram_size”: 16384,
“maximum_size”: 131072,
“protocols”: [
“teensy-cli”,
“teensy-gui”,
“jlink”
],
“protocol”: “teensy-gui”
},
“url”: “PJRC Store”,
“vendor”: “Teensy”
}
}

Here is my platformio.ini:

[env:jlink_debug_and_upload]
platform = teensy
framework = arduino
board = teensy3x
board_f_cpu = 96000000L
extra_scripts = extra_script.py
debug_tool = custom
debug_server =
C:\JLINK\JLinkGDBServerCL.exe
-singlerun
-ifls
SWD
-select
USB
-port
2331
-device
MK20DX128xxx7

and here is extra_script.py:

Import(“env”)

env.AddPostAction(
“$BUILD_DIR/firmware.hex”,
env.VerboseAction(" “.join([
“sed”, “-i.bak”,
“s/:10040000FFFFFFFFFFFFFFFFFFFFFFFFDEF9FFFF23/:10040000FFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFD/”,
“$BUILD_DIR/firmware.hex”
]), “Fixing $BUILD_DIR/firmware.hex secure flash flags”))
env.AddPreAction(
“upload”,
env.VerboseAction(” ".join([
“echo”,
“‘h\nloadfile $BUILD_DIR/firmware.hex\nr\nq\n’”,
“>$BUILD_DIR/aux.jlink”
]), “Creating auxiliary files”))

env.Replace(
UPLOADHEXCMD=
‘C:\JLINK\jlink.exe -device MK20DX128xxx7 -speed 4000 -if swd -autoconnect 1 -CommanderScript $BUILD_DIR/aux.jlink’
)