Skip to content

Commit b16a728

Browse files
committed
Switch to ARM target Example12_04a
1 parent 6c636f9 commit b16a728

60 files changed

Lines changed: 1429 additions & 1257 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/real-time-cpp-examples.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
./build.sh /usr/bin avr
5656
ls -la ./bin/${{ matrix.example }}.elf ./bin/${{ matrix.example }}.map ./bin/${{ matrix.example }}.hex
5757
working-directory: ./examples/
58-
target-bl602_sifive_e24_riscv-examples:
58+
target-stm32f100-examples:
5959
runs-on: ubuntu-latest
6060
defaults:
6161
run:
@@ -69,13 +69,11 @@ jobs:
6969
with:
7070
fetch-depth: '0'
7171
- name: update-tools
72-
run: |
73-
wget --no-check-certificate https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v15.2.0-1/xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64.tar.gz
74-
tar -xzf xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64.tar.gz -C ${{ runner.workspace }}
75-
- name: target-bl602_sifive_e24_riscv-examples
72+
run: sudo apt install gcc-arm-none-eabi
73+
- name: target-stm32f100-examples
7674
run: |
7775
cd ${{ matrix.example }}
78-
./build.sh ${{ runner.workspace }}/xpack-riscv-none-elf-gcc-15.2.0-1/bin riscv-none-elf
76+
./build.sh /usr/bin arm-none-eabi
7977
ls -la ./bin/${{ matrix.example }}.elf ./bin/${{ matrix.example }}.map ./bin/${{ matrix.example }}.hex
8078
working-directory: ./examples/
8179
target-bcm2835_raspi_b-example10_09:

examples/chapter12_04/src/os/os_cfg.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,22 @@
8787

8888
constexpr auto OS_TASK_COUNT = static_cast<std::size_t>(os::task_id_type::task_id_end);
8989

90-
#define OS_TASK_LIST \
91-
{ \
92-
{ \
93-
os::task_control_block(app::led::task_init, \
94-
app::led::task_func, \
95-
os::timer_type::microseconds(UINT32_C( 2000)), \
96-
os::timer_type::microseconds(UINT32_C( 0))), \
97-
os::task_control_block(app::benchmark::task_init, \
98-
app::benchmark::task_func, \
99-
os::timer_type::microseconds(UINT32_C( 50000)), \
100-
os::timer_type::microseconds(UINT32_C( 229))), \
101-
os::task_control_block(sys::mon::task_init, \
102-
sys::mon::task_func, \
103-
os::timer_type::microseconds(UINT32_C( 20000)), \
104-
os::timer_type::microseconds(UINT32_C( 541))), \
105-
} \
90+
#define OS_TASK_LIST \
91+
{ \
92+
{ \
93+
os::task_control_block(app::led::task_init, \
94+
app::led::task_func, \
95+
os::timer_type::microseconds(UINT32_C( 7000)), \
96+
os::timer_type::microseconds(UINT32_C( 0))), \
97+
os::task_control_block(app::benchmark::task_init, \
98+
app::benchmark::task_func, \
99+
os::timer_type::microseconds(UINT32_C( 830000)), \
100+
os::timer_type::microseconds(UINT32_C( 379))), \
101+
os::task_control_block(sys::mon::task_init, \
102+
sys::mon::task_func, \
103+
os::timer_type::microseconds(UINT32_C( 27000)), \
104+
os::timer_type::microseconds(UINT32_C( 541))), \
105+
} \
106106
}
107107

108108
static_assert(OS_TASK_COUNT > static_cast<std::size_t>(UINT8_C(0)), "the task count must exceed zero");

examples/chapter12_04a/build.bat

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@
99

1010
@rem
1111
@rem Usage:
12-
@rem build.bat directory_of_gcc_bin prefix_of_avr_gcc
12+
@rem build.bat directory_of_gcc_bin prefix_of_gcc-arm-non-eabi
1313

1414
@rem Usage example A,
1515
@rem cd "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a"
16-
@rem build.bat "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a\tools\Util\msys64\usr\local\gcc-15.2.0-riscv-none-elf\bin" riscv-none-elf
16+
@rem build.bat "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a\tools\Util\msys64\usr\local\gcc-14.2.1-arm-none-eabi\bin" arm-none-eabi
1717

1818
@rem Usage example A1 (use a relative tool path),
1919
@rem cd "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a"
20-
@rem build.bat ".\tools\Util\msys64\usr\local\gcc-15.2.0-riscv-none-elf\bin" riscv-none-elf
20+
@rem build.bat ".\tools\Util\msys64\usr\local\gcc-14.2.1-arm-none-eabi\bin" arm-none-eabi
2121

2222
@rem Usage example B,
2323
@rem cd "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a"
24-
@rem build.bat "C:\Program Files (x86)\gcc-15.2.0-riscv-none-elf\bin" riscv-none-elf
24+
@rem build.bat "C:\Program Files (x86)\gcc-14.2.1-arm-none-eabi\bin" arm-none-eabi
2525

2626

2727
@set TOOL_PATH=%1
2828
@set TOOL_PREFIX=%2
2929

30-
@set CFLAGS=-Wall -Wextra -Wpedantic -O2 -ffast-math -mcpu=sifive-e24 -mabi=ilp32 -msmall-data-limit=32 -falign-functions=4 -fno-exceptions -gdwarf-2 -ffunction-sections -fdata-sections
30+
@set CFLAGS=-Wall -Wextra -Wpedantic -O2 -finline-functions -finline-limit=64 -mcpu=cortex-m3 -mtune=cortex-m3 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -fno-exceptions -gdwarf-2 -ffunction-sections -fdata-sections
3131
@set CPPFLAGS=-std=c++14 -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs
32-
@set CINCLUDES=-Isrc/util/STL_C++XX_stdfloat -Isrc/util/STL -Isrc/mcal/bl602_sifive_e24_riscv -Isrc
32+
@set CINCLUDES=-Isrc/util/STL_C++XX_stdfloat -Isrc/util/STL -Isrc/mcal/stm32f100 -Isrc
3333

3434
@echo.
3535
@echo.Building with : build.bat
@@ -58,34 +58,34 @@
5858
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/mcal_gcc_cxx_completion.cpp -o bin/mcal_gcc_cxx_completion.o
5959

6060
@echo.Compile : mcal_cpu.cpp to bin/mcal_cpu.o
61-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_cpu.cpp -o bin/mcal_cpu.o
61+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_cpu.cpp -o bin/mcal_cpu.o
6262

6363
@echo.Compile : mcal_eep.cpp to bin/mcal_eep.o
64-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_eep.cpp -o bin/mcal_eep.o
64+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_eep.cpp -o bin/mcal_eep.o
6565

6666
@echo.Compile : mcal_gpt.cpp to bin/mcal_gpt.o
67-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_gpt.cpp -o bin/mcal_gpt.o
67+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_gpt.cpp -o bin/mcal_gpt.o
6868

6969
@echo.Compile : mcal_irq.cpp to bin/mcal_irq.o
70-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_irq.cpp -o bin/mcal_irq.o
70+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_irq.cpp -o bin/mcal_irq.o
7171

7272
@echo.Compile : mcal_led.cpp to bin/mcal_led.o
73-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_led.cpp -o bin/mcal_led.o
73+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_led.cpp -o bin/mcal_led.o
7474

7575
@echo.Compile : mcal_osc.cpp to bin/mcal_osc.o
76-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_osc.cpp -o bin/mcal_osc.o
76+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_osc.cpp -o bin/mcal_osc.o
7777

7878
@echo.Compile : mcal_port.cpp to bin/mcal_port.o
79-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_port.cpp -o bin/mcal_port.o
79+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_port.cpp -o bin/mcal_port.o
8080

8181
@echo.Compile : mcal_pwm.cpp to bin/mcal_pwm.o
82-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_pwm.cpp -o bin/mcal_pwm.o
82+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_pwm.cpp -o bin/mcal_pwm.o
8383

8484
@echo.Compile : mcal_spi.cpp to bin/mcal_spi.o
85-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_spi.cpp -o bin/mcal_spi.o
85+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_spi.cpp -o bin/mcal_spi.o
8686

8787
@echo.Compile : mcal_wdg.cpp to bin/mcal_wdg.o
88-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/bl602_sifive_e24_riscv/mcal_wdg.cpp -o bin/mcal_wdg.o
88+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_wdg.cpp -o bin/mcal_wdg.o
8989

9090
@echo.Compile : os.cpp to bin/os.o
9191
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/os/os.cpp -o bin/os.o
@@ -99,23 +99,20 @@
9999
@echo.Compile : sys_start.cpp to bin/sys_start.o
100100
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/sys/start/sys_start.cpp -o bin/sys_start.o
101101

102-
@echo.Assemble : boot.s to bin/boot.o
103-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ %CFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/boot.s -o bin/boot.o
104-
105102
@echo.Compile : crt0.cpp to bin/crt0.o
106-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/crt0.cpp -o bin/crt0.o
103+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/stm32f100/startup/crt0.cpp -o bin/crt0.o
107104

108105
@echo.Compile : crt0_init_ram.cpp to bin/crt0_init_ram.o
109-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/crt0_init_ram.cpp -o bin/crt0_init_ram.o
106+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/stm32f100/startup/crt0_init_ram.cpp -o bin/crt0_init_ram.o
110107

111108
@echo.Compile : crt1.cpp to bin/crt1.o
112-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/crt1.cpp -o bin/crt1.o
109+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c target/micros/stm32f100/startup/crt1.cpp -o bin/crt1.o
113110

114-
@echo.Compile : int_vect.c to bin/int_vect.o
115-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c %CFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/int_vect.c -o bin/int_vect.o
111+
@echo.Compile : int_vect.cpp to bin/int_vect.o
112+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CINCLUDES% -c target/micros/stm32f100/startup/int_vect.cpp -o bin/int_vect.o
116113

117114
@echo.Link : objects to bin/chapter12_04a.elf
118-
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x none -mrelax -nostartfiles %CFLAGS% %CPPFLAGS% %CINCLUDES% -Wl,--gc-sections -Wl,-Ttarget/micros/bl602_sifive_e24_riscv/make/bl602_sifive_e24_riscv.ld,-Map,bin/chapter12_04a.map bin/app_benchmark.o bin/app_led.o bin/cmath_impl_gamma.o bin/mcal.o bin/mcal_gcc_cxx_completion.o bin/mcal_cpu.o bin/mcal_eep.o bin/mcal_gpt.o bin/mcal_irq.o bin/mcal_led.o bin/mcal_osc.o bin/mcal_port.o bin/mcal_pwm.o bin/mcal_spi.o bin/mcal_wdg.o bin/os.o bin/sys_idle.o bin/sys_mon.o bin/sys_start.o bin/boot.o bin/crt0.o bin/crt0_init_ram.o bin/crt1.o bin/int_vect.o -o bin/chapter12_04a.elf
115+
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x none -nostartfiles %CFLAGS% %CPPFLAGS% %CINCLUDES% -Wl,--gc-sections -Wl,-Ttarget/micros/stm32f100/make/stm32f100.ld,-Map,bin/chapter12_04a.map bin/app_benchmark.o bin/app_led.o bin/cmath_impl_gamma.o bin/mcal.o bin/mcal_gcc_cxx_completion.o bin/mcal_cpu.o bin/mcal_eep.o bin/mcal_gpt.o bin/mcal_irq.o bin/mcal_led.o bin/mcal_osc.o bin/mcal_port.o bin/mcal_pwm.o bin/mcal_spi.o bin/mcal_wdg.o bin/os.o bin/sys_idle.o bin/sys_mon.o bin/sys_start.o bin/crt0.o bin/crt0_init_ram.o bin/crt1.o bin/int_vect.o -o bin/chapter12_04a.elf
119116

120117
@echo.
121118
@echo.Extract : executable hex file : from bin/chapter12_04a.elf
@@ -135,7 +132,7 @@
135132

136133
dir .\bin\chapter12_04a.elf .\bin\chapter12_04a.hex
137134

138-
rem if not exist .\bin\chapter12_04a.elf exit 1
139-
rem if not exist .\bin\chapter12_04a.hex exit 1
135+
if not exist .\bin\chapter12_04a.elf exit 1
136+
if not exist .\bin\chapter12_04a.hex exit 1
140137

141-
rem exit 0
138+
exit 0

0 commit comments

Comments
 (0)