|
| 1 | +@REM Copyright (c) 2025, Arm Limited and affiliates. |
| 2 | +@REM |
| 3 | +@REM Part of the Arm Toolchain project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | +@REM See https://llvm.org/LICENSE.txt for license information. |
| 5 | +@REM SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | + |
| 7 | +@if [%1]==[] goto :target_empty |
| 8 | +@set target=%1 |
| 9 | +@goto :make |
| 10 | +:target_empty |
| 11 | +@set target=build |
| 12 | + |
| 13 | +:make |
| 14 | +@if [%target%]==[build] goto :build |
| 15 | +@if [%target%]==[run] goto :run |
| 16 | +@if [%target%]==[clean] goto :clean |
| 17 | +@echo Error: unknown target "%target%" |
| 18 | +@exit /B 1 |
| 19 | + |
| 20 | +:build |
| 21 | +@if [%BIN_PATH%]==[] goto :bin_path_empty |
| 22 | +@call :build_fn |
| 23 | +@exit /B |
| 24 | + |
| 25 | +:run |
| 26 | +@if exist hello.hex goto :do_run |
| 27 | +@if [%BIN_PATH%]==[] goto :bin_path_empty |
| 28 | +@call :build_fn |
| 29 | +:do_run |
| 30 | +qemu-system-arm.exe -M mps2-an386 -semihosting -nographic -device loader,file=hello.hex |
| 31 | +qemu-system-arm.exe -M mps2-an386 -semihosting -nographic -device loader,file=hello-exn.hex |
| 32 | + |
| 33 | +@exit /B |
| 34 | + |
| 35 | +:clean |
| 36 | +if exist hello.elf del /q hello.elf |
| 37 | +if exist hello-exn.elf del /q hello-exn.elf |
| 38 | +if exist hello.hex del /q hello.hex |
| 39 | +if exist hello-exn.hex del /q hello-exn.hex |
| 40 | +@exit /B |
| 41 | + |
| 42 | +:bin_path_empty |
| 43 | +@echo Error: BIN_PATH environment variable is not set |
| 44 | +@exit /B 1 |
| 45 | + |
| 46 | +:build_fn |
| 47 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -fno-exceptions -fno-rtti --config=newlib.cfg -lcrt0-rdimon -lrdimon -g -T ..\..\ldscripts\newlib-cm4.ld -o hello.elf hello.cpp ..\..\startup\startup_ARMCM4.S |
| 48 | +%BIN_PATH%\clang++.exe --target=armv6m-none-eabi -mfloat-abi=soft -march=armv6m -mfpu=none -nostartfiles -DTEST_EXN --config=newlib.cfg -lcrt0-rdimon -lrdimon -g -T ..\..\ldscripts\newlib-cm4.ld -o hello-exn.elf hello.cpp ..\..\startup\startup_ARMCM4.S |
| 49 | +%BIN_PATH%\llvm-objcopy.exe -O ihex hello.elf hello.hex |
| 50 | +%BIN_PATH%\llvm-objcopy.exe -O ihex hello-exn.elf hello-exn.hex |
| 51 | +@exit /B |
0 commit comments