Skip to content

Commit

Permalink
Add some limited JSON Patch support for board description files.
Browse files Browse the repository at this point in the history
Boards can now be provided as .patch files that are JSON documents
containing two nodes:

 - `base` is the board that this is based on, which can be another
   .patch file, a full path (note: relative paths are not yet supported,
   but they should be for out-of-tree BSPs).
 - `patch` is a JSON Patch.

The patch is a subset of RFC 6902.  Current limitations:

 - It doesn't handle escapes in keys or any weird keys.
 - It assumes that numbers in the JSON Pointer path are array indexes
   and will do the wrong thing if you try to replace or add an object
   field with a number as a key.
 - It doesn't implement the copy, move, or test operations, only add,
   remove, and replace.

This is sufficient to be useful.  The Arty A7 and Sonata Simulator JSON
files are now replaced with patches.
  • Loading branch information
davidchisnall committed Jan 17, 2025
1 parent f485b5d commit 3cffc5c
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 233 deletions.
76 changes: 0 additions & 76 deletions sdk/boards/ibex-arty-a7-100.json

This file was deleted.

77 changes: 77 additions & 0 deletions sdk/boards/ibex-arty-a7-100.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"base": "ibex-safe-simulator",
"patch": [
{
"op": "add",
"path": "/devices/gpio_led0",
"value": {
"start": 0x8f00f000,
"length": 0x800
}
},
{
"op": "add",
"path": "/kunyan_ethernet",
"value": {
"start": 0x14004000,
"end": 0x14008000
}
},
{
"op": "add",
"path": "/interrupts/1",
"value": {
"name": "UARTInterrupt",
"number": 2,
"priority": 3,
"edge_triggered": true
}
},
{
"op": "add",
"path": "/interrupts/2",
"value": {
"name": "EthernetTransmitInterrupt",
"number": 3,
"priority": 3
}
},
{
"op": "add",
"path": "/interrupts/3",
"value": {
"name": "EthernetReceiveInterrupt",
"number": 4,
"priority": 3
}
},
{
"op": "add",
"path": "/driver_includes/0",
"value": "${sdk}/include/platform/synopsis"
},
{
"op": "add",
"path": "/driver_includes/0",
"value": "${sdk}/include/platform/arty-a7"
},
{
"op": "replace",
"path": "/timer_hz",
"value": 33000000
},
{
"op": "replace",
"path": "/tickrate_hz",
"value": 100
},
{
"op": "remove",
"path": "/simulation"
},
{
"op": "remove",
"path": "/simulator"
}
]
}
144 changes: 0 additions & 144 deletions sdk/boards/sonata-simulator.json

This file was deleted.

15 changes: 15 additions & 0 deletions sdk/boards/sonata-simulator.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"base": "sonata-prerelease",
"patch": [
{
"op": "replace",
"path": "/simulation",
"value": true
},
{
"op": "replace",
"path": "/simulator",
"value": "${sdk}/../scripts/run-sonata-sim.sh"
}
]
}
Loading

0 comments on commit 3cffc5c

Please sign in to comment.