generated from microbit-foundation/micropython-cpp-module-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmicropython-microbit-v2.patch
91 lines (85 loc) · 3.46 KB
/
micropython-microbit-v2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
diff --git a/src/addlayouttable.py b/src/addlayouttable.py
index 4e7fe1e..96a27c5 100755
--- a/src/addlayouttable.py
+++ b/src/addlayouttable.py
@@ -193,13 +193,14 @@ def main():
"microbit_version_string",
]
}
parse_map_file(args.mapfile[0], symbols)
# Get the required symbol addresses.
- sd_start = symbols["_binary_softdevice_bin_start"]
+ # SoftDevice might not be present if codal.json is configured with DEVICE_BLE: 0
+ sd_start = symbols["_binary_softdevice_bin_start"] or 0
sd_end = symbols["__isr_vector"]
mp_start = symbols["__isr_vector"]
data_len = symbols["__data_end__"] - symbols["__data_start__"]
mp_end = symbols["__etext"] + data_len
mp_version = symbols["microbit_version_string"]
fs_start = symbols["_fs_start"]
@@ -209,33 +210,40 @@ def main():
layout = FlashLayout()
layout.add_region(1, sd_start, sd_end - sd_start, FlashLayout.REGION_HASH_NONE)
layout.add_region(
2, mp_start, mp_end - mp_start, FlashLayout.REGION_HASH_PTR, mp_version
)
layout.add_region(3, fs_start, fs_end - fs_start, FlashLayout.REGION_HASH_NONE)
- layout.finalise()
# Compute layout address.
layout_addr = (
((mp_end >> NRF_PAGE_SIZE_LOG2) << NRF_PAGE_SIZE_LOG2)
+ NRF_PAGE_SIZE
- len(layout.data)
)
if layout_addr < mp_end:
layout_addr += NRF_PAGE_SIZE
if layout_addr >= fs_start:
print("ERROR: Flash layout information overlaps with filesystem")
sys.exit(1)
+ layout_end = layout_addr + len(layout.data)
+
+ # Add the ML model region between the layout table and the filesystem.
+ ml_start = layout_end
+ ml_end = fs_start
+ layout.add_region(4, ml_start, ml_end - ml_start, FlashLayout.REGION_HASH_NONE)
+ layout.finalise()
# Print information.
if args.output is not sys.stdout:
fmt = "{:13} 0x{:05x}..0x{:05x} {:6} bytes"
print(fmt.format("SoftDevice", sd_start, sd_end, sd_end - sd_start))
print(fmt.format("MicroPython", mp_start, mp_end, mp_end - mp_start))
- print(fmt.format("Layout table", layout_addr, layout_addr + len(layout.data), len(layout.data)))
+ print(fmt.format("Layout table", layout_addr, layout_end, len(layout.data)))
print(fmt.format("Filesystem", fs_start, fs_end, fs_end - fs_start))
+ print(fmt.format("ML model", ml_start, ml_end, ml_end - ml_start))
# Output the new firmware as a hex file.
output_firmware(args.output, firmware, layout_addr, layout.data)
if __name__ == "__main__":
diff --git a/src/codal_app/codal.json b/src/codal_app/codal.json
index f1d9977..25fa292 100644
--- a/src/codal_app/codal.json
+++ b/src/codal_app/codal.json
@@ -4,12 +4,13 @@
"url": "https://github.com/lancaster-university/codal-microbit-v2",
"branch": "v0.2.66",
"type": "git",
"test_ignore": true
} ,
"config":{
+ "DEVICE_BLE": 0,
"DEVICE_STACK_SIZE": 8192,
"MICROBIT_BLE_ENABLED" : 0,
"MICROBIT_BLE_PAIRING_MODE": 1,
"MICROBIT_BLE_PARTIAL_FLASHING" : 1,
"MICROBIT_BLE_SECURITY_MODE": 2,
"MICROBIT_BLE_UTILITY_SERVICE_PAIRING": 1,
diff --git a/src/codal_port/filesystem.ld b/src/codal_port/filesystem.ld
index 4e262c8..cfd4a29 100644
--- a/src/codal_port/filesystem.ld
+++ b/src/codal_port/filesystem.ld
@@ -1,3 +1,3 @@
/* 24k filesystem */
-_fs_start = 0x6D000;
-_fs_end = 0x73000;
+_fs_start = 0x7A000;
+_fs_end = 0x80000;