|
| 1 | +@REM Copyright (c) 2024, Arm Limited and affiliates. |
| 2 | +@REM SPDX-License-Identifier: Apache-2.0 |
| 3 | +@REM |
| 4 | +@REM Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +@REM you may not use this file except in compliance with the License. |
| 6 | +@REM You may obtain a copy of the License at |
| 7 | +@REM |
| 8 | +@REM http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +@REM |
| 10 | +@REM Unless required by applicable law or agreed to in writing, software |
| 11 | +@REM distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +@REM See the License for the specific language governing permissions and |
| 14 | +@REM limitations under the License. |
| 15 | + |
| 16 | +@if [%1]==[] goto :target_empty |
| 17 | +@set target=%1 |
| 18 | +@goto :make |
| 19 | +:target_empty |
| 20 | +@set target=build |
| 21 | + |
| 22 | +:make |
| 23 | +@if [%target%]==[build] goto :build |
| 24 | +@if [%target%]==[run] goto :run |
| 25 | +@if [%target%]==[clean] goto :clean |
| 26 | +@echo Error: unknown target "%target%" |
| 27 | +@exit /B 1 |
| 28 | + |
| 29 | +:build |
| 30 | +@if [%BIN_PATH%]==[] goto :bin_path_empty |
| 31 | +@call :build_fn |
| 32 | +@exit /B |
| 33 | + |
| 34 | +:run |
| 35 | +@if exist hello.hex goto :do_run |
| 36 | +@if [%BIN_PATH%]==[] goto :bin_path_empty |
| 37 | +@call :build_fn |
| 38 | +:do_run |
| 39 | +qemu-system-arm.exe -M microbit -semihosting -nographic -device loader,file=hello.hex |
| 40 | +qemu-system-arm.exe -M microbit -semihosting -nographic -device loader,file=hello-exn.hex |
| 41 | +@exit /B |
| 42 | + |
| 43 | +:clean |
| 44 | +if exist hello.elf del /q hello.elf |
| 45 | +if exist hello.hex del /q hello.hex |
| 46 | +if exist hello-exn.elf del /q hello-exn.elf |
| 47 | +if exist hello-exn.hex del /q hello-exn.hex |
| 48 | +@exit /B |
| 49 | + |
| 50 | +:bin_path_empty |
| 51 | +@echo Error: BIN_PATH environment variable is not set |
| 52 | +@exit /B 1 |
| 53 | + |
| 54 | +:build_fn |
| 55 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -print-multi-directory -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.cpp |
| 56 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -fno-exceptions -fno-rtti -g -T ..\..\ldscripts\microbit.ld -o hello.elf hello.cpp |
| 57 | +%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex |
| 58 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -print-multi-directory -g -T ..\..\ldscripts\microbit.ld -o hello-exn.elf hello-exn.cpp |
| 59 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -lcrt0-semihost -lsemihost -g -T ..\..\ldscripts\microbit.ld -o hello-exn.elf hello-exn.cpp |
| 60 | +%BIN_PATH%\llvm-objcopy.exe -O ihex hello-exn.elf hello-exn.hex |
| 61 | +@exit /B |
| 62 | + |
| 63 | +:build_exn_fn |
| 64 | +@exit /B |
0 commit comments