Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/real-time-cpp-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
./build.sh /usr/bin avr
ls -la ./bin/${{ matrix.example }}.elf ./bin/${{ matrix.example }}.map ./bin/${{ matrix.example }}.hex
working-directory: ./examples/
target-bl602_sifive_e24_riscv-examples:
target-stm32f100-examples:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -69,13 +69,11 @@ jobs:
with:
fetch-depth: '0'
- name: update-tools
run: |
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
tar -xzf xpack-riscv-none-elf-gcc-15.2.0-1-linux-x64.tar.gz -C ${{ runner.workspace }}
- name: target-bl602_sifive_e24_riscv-examples
run: sudo apt install gcc-arm-none-eabi
- name: target-stm32f100-examples
run: |
cd ${{ matrix.example }}
./build.sh ${{ runner.workspace }}/xpack-riscv-none-elf-gcc-15.2.0-1/bin riscv-none-elf
./build.sh /usr/bin arm-none-eabi
ls -la ./bin/${{ matrix.example }}.elf ./bin/${{ matrix.example }}.map ./bin/${{ matrix.example }}.hex
working-directory: ./examples/
target-bcm2835_raspi_b-example10_09:
Expand Down
32 changes: 16 additions & 16 deletions examples/chapter12_04/src/os/os_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,22 @@

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

#define OS_TASK_LIST \
{ \
{ \
os::task_control_block(app::led::task_init, \
app::led::task_func, \
os::timer_type::microseconds(UINT32_C( 2000)), \
os::timer_type::microseconds(UINT32_C( 0))), \
os::task_control_block(app::benchmark::task_init, \
app::benchmark::task_func, \
os::timer_type::microseconds(UINT32_C( 50000)), \
os::timer_type::microseconds(UINT32_C( 229))), \
os::task_control_block(sys::mon::task_init, \
sys::mon::task_func, \
os::timer_type::microseconds(UINT32_C( 20000)), \
os::timer_type::microseconds(UINT32_C( 541))), \
} \
#define OS_TASK_LIST \
{ \
{ \
os::task_control_block(app::led::task_init, \
app::led::task_func, \
os::timer_type::microseconds(UINT32_C( 7000)), \
os::timer_type::microseconds(UINT32_C( 0))), \
os::task_control_block(app::benchmark::task_init, \
app::benchmark::task_func, \
os::timer_type::microseconds(UINT32_C( 830000)), \
os::timer_type::microseconds(UINT32_C( 379))), \
os::task_control_block(sys::mon::task_init, \
sys::mon::task_func, \
os::timer_type::microseconds(UINT32_C( 27000)), \
os::timer_type::microseconds(UINT32_C( 541))), \
} \
}

static_assert(OS_TASK_COUNT > static_cast<std::size_t>(UINT8_C(0)), "the task count must exceed zero");
Expand Down
53 changes: 25 additions & 28 deletions examples/chapter12_04a/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@

@rem
@rem Usage:
@rem build.bat directory_of_gcc_bin prefix_of_avr_gcc
@rem build.bat directory_of_gcc_bin prefix_of_gcc-arm-non-eabi

@rem Usage example A,
@rem cd "C:\Users\ckorm\Documents\Ks\uC_Software\Boards\real-time-cpp\examples\chapter12_04a"
@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
@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

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

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


@set TOOL_PATH=%1
@set TOOL_PREFIX=%2

@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
@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
@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
@set CINCLUDES=-Isrc/util/STL_C++XX_stdfloat -Isrc/util/STL -Isrc/mcal/bl602_sifive_e24_riscv -Isrc
@set CINCLUDES=-Isrc/util/STL_C++XX_stdfloat -Isrc/util/STL -Isrc/mcal/stm32f100 -Isrc

@echo.
@echo.Building with : build.bat
Expand Down Expand Up @@ -58,34 +58,34 @@
@%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

@echo.Compile : mcal_cpu.cpp to bin/mcal_cpu.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_cpu.cpp -o bin/mcal_cpu.o

@echo.Compile : mcal_eep.cpp to bin/mcal_eep.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_eep.cpp -o bin/mcal_eep.o

@echo.Compile : mcal_gpt.cpp to bin/mcal_gpt.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_gpt.cpp -o bin/mcal_gpt.o

@echo.Compile : mcal_irq.cpp to bin/mcal_irq.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_irq.cpp -o bin/mcal_irq.o

@echo.Compile : mcal_led.cpp to bin/mcal_led.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_led.cpp -o bin/mcal_led.o

@echo.Compile : mcal_osc.cpp to bin/mcal_osc.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_osc.cpp -o bin/mcal_osc.o

@echo.Compile : mcal_port.cpp to bin/mcal_port.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_port.cpp -o bin/mcal_port.o

@echo.Compile : mcal_pwm.cpp to bin/mcal_pwm.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_pwm.cpp -o bin/mcal_pwm.o

@echo.Compile : mcal_spi.cpp to bin/mcal_spi.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_spi.cpp -o bin/mcal_spi.o

@echo.Compile : mcal_wdg.cpp to bin/mcal_wdg.o
@%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
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CPPFLAGS% %CINCLUDES% -c src/mcal/stm32f100/mcal_wdg.cpp -o bin/mcal_wdg.o

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

@echo.Assemble : boot.s to bin/boot.o
@%TOOL_PATH%\%TOOL_PREFIX%-g++ %CFLAGS% %CINCLUDES% -c target/micros/bl602_sifive_e24_riscv/startup/boot.s -o bin/boot.o

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

@echo.Compile : crt0_init_ram.cpp to bin/crt0_init_ram.o
@%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
@%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

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

@echo.Compile : int_vect.c to bin/int_vect.o
@%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
@echo.Compile : int_vect.cpp to bin/int_vect.o
@%TOOL_PATH%\%TOOL_PREFIX%-g++ -x c++ %CFLAGS% %CINCLUDES% -c target/micros/stm32f100/startup/int_vect.cpp -o bin/int_vect.o

@echo.Link : objects to bin/chapter12_04a.elf
@%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
@%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

@echo.
@echo.Extract : executable hex file : from bin/chapter12_04a.elf
Expand All @@ -135,7 +132,7 @@

dir .\bin\chapter12_04a.elf .\bin\chapter12_04a.hex

rem if not exist .\bin\chapter12_04a.elf exit 1
rem if not exist .\bin\chapter12_04a.hex exit 1
if not exist .\bin\chapter12_04a.elf exit 1
if not exist .\bin\chapter12_04a.hex exit 1

rem exit 0
exit 0
Loading