File tree Expand file tree Collapse file tree 5 files changed +31
-38
lines changed
Expand file tree Collapse file tree 5 files changed +31
-38
lines changed Original file line number Diff line number Diff line change 1- lib / codal
1+ src / build
22src /MICROBIT.hex
33src /codal_port /build
44src /codal_port /libmicropython.a
Original file line number Diff line number Diff line change @@ -11,14 +11,9 @@ After cloning this repository update the submodules:
1111
1212 $ git submodule update --init
1313
14- Currently lib/micropython is the only submodule registered with git. The codal
15- sub-repository and its dependencies must be explicitly cloned using:
14+ Then build the MicroPython cross-compiler:
1615
17- $ git clone https://github.com/lancaster-university/codal.git lib/codal
18- $ git clone --recurse-submodules https://github.com/lancaster-university/codal-core.git lib/codal/libraries/codal-core
19- $ git clone --recurse-submodules https://github.com/lancaster-university/codal-nrf52.git lib/codal/libraries/codal-nrf52
20- $ git clone --recurse-submodules https://github.com/microbit-foundation/codal-microbit-nrf5sdk.git lib/codal/libraries/codal-microbit-nrf5sdk
21- $ git clone --recurse-submodules https://github.com/lancaster-university/codal-microbit-v2.git lib/codal/libraries/codal-microbit-v2
16+ $ make -C lib/micropython/mpy-cross
2217
2318Building and running
2419--------------------
@@ -36,3 +31,4 @@ Once the firmware is on the device there will appear a REPL prompt on the serial
3631port. To test it you can run:
3732
3833 >>> display.show(Image.HAPPY)
34+ >>> audio.play(Sound.HAPPY)
Original file line number Diff line number Diff line change 11CODAL_DIR = ../lib/codal
22RM = /bin/rm
3+ MKDIR = /bin/mkdir
34PYTHON3 ?= python3
45
5- SRC_HEX = $(CODAL_DIR ) /MICROBIT.hex
6- SRC_MAP = $(CODAL_DIR ) /build/MICROBIT.map
6+ BUILD = ./build
7+ CODAL_BUILD = $(CODAL_DIR ) /build
8+ CODAL_LIBRARIES = $(CODAL_DIR ) /libraries
9+ SRC_HEX = $(BUILD ) /MICROBIT.hex
10+ SRC_MAP = $(CODAL_BUILD ) /MICROBIT.map
711DEST_HEX = ./MICROBIT.hex
812
9- .PHONY : all clean
13+ .PHONY : all codal_build libmicropython clean
1014
11- all :
15+ all : codal_build
16+
17+ codal_build : libmicropython
18+ make -C $(BUILD )
19+ arm-none-eabi-size $(CODAL_BUILD ) /MICROBIT
20+ $(PYTHON3 ) addlayouttable.py $(SRC_HEX ) $(SRC_MAP ) -o $(DEST_HEX )
21+
22+ libmicropython : $(CODAL_DIR ) /libraries
1223 $(MAKE ) -C codal_port
13- git -C $(CODAL_DIR ) checkout CMakeLists.txt build.py
24+
25+ $(CODAL_LIBRARIES ) :
26+ $(MKDIR ) -p $(BUILD )
27+ git -C $(CODAL_DIR ) checkout CMakeLists.txt
1428 cat codal.patch | git -C $(CODAL_DIR ) apply -
15- (cd $( CODAL_DIR) && ./build.py)
16- arm-none-eabi-size $(CODAL_DIR ) /build/MICROBIT
17- $(PYTHON3 ) addlayouttable.py $(SRC_HEX ) $(SRC_MAP ) -o $(DEST_HEX )
29+ (cd $( BUILD) && cmake ../$( CODAL_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo)
1830
1931clean :
2032 $(MAKE ) -C codal_port clean
21- $(RM ) -r $(CODAL_DIR ) /build/
33+ $(RM ) -rf $(BUILD )
34+ $(RM ) -rf $(CODAL_BUILD )
35+ $(RM ) -rf $(CODAL_LIBRARIES )
2236 $(RM ) MICROBIT.hex
Original file line number Diff line number Diff line change @@ -23,20 +23,3 @@ index b89e1d0..b53224b 100644
2323+ IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/../../src/codal_port/libmicropython.a"
2424+ )
2525+ target_link_libraries("MICROBIT" micropython)
26- diff --git a/build.py b/build.py
27- index f21ee38..3b676ef 100755
28- --- a/build.py
29- +++ b/build.py
30- @@ -125,9 +125,9 @@ elif len(args) > 1:
31-
32- if not options.test_platform:
33-
34- - if not os.path.exists("../codal.json"):
35- - print("No target specified in codal.json, does codal.json exist?")
36- - exit(1)
37- + #if not os.path.exists("../codal.json"):
38- + # print("No target specified in codal.json, does codal.json exist?")
39- + # exit(1)
40-
41- if options.generate_docs:
42- generate_docs()
Original file line number Diff line number Diff line change 22 "target" : {
33 "name" : " codal-microbit-v2" ,
44 "url" : " https://github.com/lancaster-university/codal-microbit-v2" ,
5- "branch" : " master " ,
5+ "branch" : " v0.2.21 " ,
66 "type" : " git" ,
7- "test_ignore" : true ,
8- "dev" : true
7+ "test_ignore" : true
98 } ,
109 "config" :{
1110 "DEVICE_STACK_SIZE" : 8192 ,
1211 "MICROBIT_BLE_ENABLED" : 0 ,
1312 "MICROBIT_BLE_PAIRING_MODE" : 1 ,
1413 "MICROBIT_BLE_SECURITY_MODE" : 2
1514 },
16- "application" : " ../../src/codal_app"
15+ "application" : " ../../src/codal_app" ,
16+ "output_folder" : " ../../src/build"
1717}
You can’t perform that action at this time.
0 commit comments