Skip to content

Commit

Permalink
Repair CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Nov 23, 2024
1 parent 15ca224 commit ba25498
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 211 deletions.
75 changes: 25 additions & 50 deletions .github/workflows/real-time-cpp-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,45 +198,8 @@ jobs:
ls -la ./bin/app_benchmark_cnl_scaled_integer.exe
./bin/app_benchmark_cnl_scaled_integer.exe
working-directory: ./ref_app/
benchmark_single-stm32f429-qemu-cnl:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: update-tools
run: |
sudo apt install libncurses5 libpython2.7
mkdir -p emu_env && cd emu_env
wget --no-check-certificate https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.1.0-1/xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz
tar -xzf xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz
working-directory: ./ref_app/
- name: benchmark_single-stm32f429-qemu-cnl
run: |
git clone -b main --depth 1 https://github.com/johnmcfarlane/cnl.git ../cnl-root
mkdir -p bin
./emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++ -std=c++20 -Wall -Wextra -pedantic -O2 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=128 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I./src/mcal/stm32f429 -I./src -I../cnl-root/include -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CNL_SCALED_INTEGER -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_cnl_scaled_integer.cpp ./target/micros/stm32f429/make/single/crt.cpp -nostartfiles -Wl,--gc-sections -Wl,-Map,./bin/app_benchmark_cnl_scaled_integer.map -T ./target/micros/stm32f429/make/stm32f429.ld -o ./bin/app_benchmark_cnl_scaled_integer.elf
./emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-objcopy ./bin/app_benchmark_cnl_scaled_integer.elf -O ihex ./bin/app_benchmark_cnl_scaled_integer.hex
ls -la ./bin/app_benchmark_cnl_scaled_integer.elf ./bin/app_benchmark_cnl_scaled_integer.hex ./bin/app_benchmark_cnl_scaled_integer.map
working-directory: ./ref_app/
- name: emulate-target stm32f429
run: |
./emu_env/xpack-qemu-arm-7.1.0-1/bin/qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
working-directory: ./ref_app/
- name: run-test-on-target
run: |
./emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb-py ./bin/app_benchmark_cnl_scaled_integer.elf -x ./target/build/test_app_benchmarks_emulator.py
qemu_result=$?
echo "qemu_result" "$qemu_result"
echo "qemu_result" "$qemu_result" | grep 'qemu_result 0'
working-directory: ./ref_app/
benchmark_single-stm32f429-qemu:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
defaults:
run:
shell: bash
Expand All @@ -246,28 +209,40 @@ jobs:
fetch-depth: '0'
- name: update-tools
run: |
sudo apt install libncurses5 libpython2.7
sudo apt install libncursesw5
mkdir -p emu_env && cd emu_env
wget --no-check-certificate https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
tar -xf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.1.0-1/xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz
tar -xzf xpack-qemu-arm-7.1.0-1-linux-x64.tar.gz
wget --no-check-certificate https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
tar -xf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v8.2.6-1/xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
tar -xzf xpack-qemu-arm-8.2.6-1-linux-x64.tar.gz
working-directory: ./ref_app/
- name: build benchmark_single-stm32f429
run: |
PATH="${{ runner.workspace }}/qemu_arm_sample/ref_app/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Query arm-none-eabi-g++ version'
echo
arm-none-eabi-g++ -v
echo
mkdir -p bin
emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++ -std=c++20 -Wall -Wextra -pedantic -O0 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I./src/mcal/stm32f429 -I./src -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CRC -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_crc.cpp ./target/micros/stm32f429/make/single/crt.cpp -nostartfiles -Wl,--gc-sections -Wl,-Map,./bin/app_benchmark_crc.map -T ./target/micros/stm32f429/make/stm32f429.ld --specs=nano.specs --specs=nosys.specs -o ./bin/app_benchmark_crc.elf
emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-objcopy ./bin/app_benchmark_crc.elf -O ihex ./bin/app_benchmark_crc.hex
arm-none-eabi-g++ -std=c++20 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O2 -g -gdwarf-2 -ffunction-sections -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I./src/mcal/stm32f429 -I./src -DAPP_BENCHMARK_TYPE=APP_BENCHMARK_TYPE_CRC -DAPP_BENCHMARK_STANDALONE_MAIN ./src/app/benchmark/app_benchmark_crc.cpp ./target/micros/stm32f429/make/single/crt.cpp -nostartfiles -nostdlib -Wl,--gc-sections -Wl,-Map,./bin/app_benchmark_crc.map -T ./target/micros/stm32f429/make/stm32f429.ld --specs=nano.specs --specs=nosys.specs -o ./bin/app_benchmark_crc.elf
arm-none-eabi-objcopy ./bin/app_benchmark_crc.elf -O ihex ./bin/app_benchmark_crc.hex
ls -la ./bin/app_benchmark_crc.elf ./bin/app_benchmark_crc.hex ./bin/app_benchmark_crc.map
working-directory: ./ref_app/
- name: emulate-target stm32f429
run: |
./emu_env/xpack-qemu-arm-7.1.0-1/bin/qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
PATH="${{ runner.workspace }}/qemu_arm_sample/ref_app/emu_env/xpack-qemu-arm-8.2.6-1/bin:$PATH"
qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
sleep 2
working-directory: ./ref_app/
- name: run-test-on-target
run: |
./emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb-py ./bin/app_benchmark_crc.elf -x ./target/build/test_app_benchmarks_emulator.py
qemu_result=$?
echo "qemu_result" "$qemu_result"
echo "qemu_result" "$qemu_result" | grep 'qemu_result 0'
sleep 2
PATH="${{ runner.workspace }}/qemu_arm_sample/ref_app/emu_env/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/bin:$PATH"
echo 'Run test on target'
echo
arm-none-eabi-gdb ./bin/app_benchmark_crc.elf -x ./target/build/test_app_benchmarks_emulator.gdb > ./app_benchmark_crc.txt
cat ./app_benchmark_crc.txt
echo
echo 'We will now grep for the right answer...'
grep 'value 0xF00DCAFE' ./app_benchmark_crc.txt
working-directory: ./ref_app/
2 changes: 1 addition & 1 deletion ref_app/target.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@
<None Include="target\build\build.sh" />
<None Include="target\build\test_app_benchmarks.sh" />
<None Include="target\build\test_app_benchmarks_avr.sh" />
<None Include="target\build\test_app_benchmarks_emulator.py" />
<None Include="target\build\test_app_benchmarks_emulator.gdb" />
<None Include="target\build\test_app_benchmarks_riscv.sh" />
<None Include="target\build\test_app_benchmarks_stm32f446.sh" />
<None Include="target\micros\am335x\make\am335x.ld" />
Expand Down
6 changes: 3 additions & 3 deletions ref_app/target.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,6 @@
<None Include="target\micros\v850es_fx2\startup\errno.s">
<Filter>micros\v850es_fx2\startup</Filter>
</None>
<None Include="target\build\test_app_benchmarks_emulator.py">
<Filter>build</Filter>
</None>
<None Include="target\micros\stm32h7a3\make\stm32h7a3_files.gmk">
<Filter>micros\stm32h7a3\make</Filter>
</None>
Expand Down Expand Up @@ -612,6 +609,9 @@
<None Include="target\micros\rpi_pico2_rp2350\startup\util.cpp">
<Filter>micros\rpi_pico2_rp2350\startup</Filter>
</None>
<None Include="target\build\test_app_benchmarks_emulator.gdb">
<Filter>build</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Target\Micros\AVR\Startup\int_vect.cpp">
Expand Down
28 changes: 28 additions & 0 deletions ref_app/target/build/test_app_benchmarks_emulator.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ///////////////////////////////////////////////////////////////////
# // Copyright Christopher Kormanyos 2020 - 2024.
# // Distributed under the Boost Software License,
# // Version 1.0. (See accompanying file LICENSE_1_0.txt
# // or copy at http://www.boost.org/LICENSE_1_0.txt)
# //

# Connect to the target (e.g., OpenOCD or another GDB server).
target remote localhost:9999
monitor halt

# Ensure that the program is loaded.
load

# Set a breakpoint at the specified subroutine.
break app_benchmark_get_standalone_result

# Start or continue program execution.
continue

# Format and print the value of a variable.
printf "value 0x%X\n\n", app_benchmark_standalone_result

# Delete (all) breakpoint(s).
delete

# Perform a non-elegant quit of the GDB session.
quit
131 changes: 0 additions & 131 deletions ref_app/target/build/test_app_benchmarks_emulator.py

This file was deleted.

62 changes: 36 additions & 26 deletions ref_app/target/micros/stm32f429/make/single/crt.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2018 - 2019.
// Copyright Christopher Kormanyos 2018 - 2024.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow="
#endif

#include <algorithm>
#include <array>
#include <cstddef>
Expand Down Expand Up @@ -36,7 +43,8 @@ void __my_startup(void)
// the base position of the interrupt vector table.
// So we do nothing here.

// TBD: Chip init: Watchdog, port, and oscillator, if any needed.
// Note: Not needed:
// Chip init: Watchdog, port, and oscillator, if any needed.

// Initialize statics from ROM to RAM.
// Zero-clear default-initialized static RAM.
Expand All @@ -49,9 +57,7 @@ void __my_startup(void)
asm volatile("ldr r3, =main");
asm volatile("blx r3");

exit(EXIT_SUCCESS);

// TBD: Nothing on return from main.
// Do nothing on return from main.
}

extern "C" void _exit (int);
Expand Down Expand Up @@ -113,31 +119,31 @@ void crt::init_ctors()
extern "C" void __initial_stack_pointer();

extern "C" void __my_startup () __attribute__((used, noinline));
extern "C" void __vector_unused_irq (void) __attribute__((used, noinline));
extern "C" void __nmi_handler (void) __attribute__((used, noinline));
extern "C" void __hard_fault_handler (void) __attribute__((used, noinline));
extern "C" void __mem_manage_handler (void) __attribute__((used, noinline));
extern "C" void __bus_fault_handler (void) __attribute__((used, noinline));
extern "C" void __usage_fault_handler(void) __attribute__((used, noinline));
extern "C" void __svc_handler (void) __attribute__((used, noinline));
extern "C" void __debug_mon_handler (void) __attribute__((used, noinline));
extern "C" void __pend_sv_handler (void) __attribute__((used, noinline));
extern "C" void __sys_tick_handler (void) __attribute__((used, noinline));
extern "C" void __vector_unused_irq () __attribute__((used, noinline));
extern "C" void __nmi_handler () __attribute__((used, noinline));
extern "C" void __hard_fault_handler () __attribute__((used, noinline));
extern "C" void __mem_manage_handler () __attribute__((used, noinline));
extern "C" void __bus_fault_handler () __attribute__((used, noinline));
extern "C" void __usage_fault_handler() __attribute__((used, noinline));
extern "C" void __svc_handler () __attribute__((used, noinline));
extern "C" void __debug_mon_handler () __attribute__((used, noinline));
extern "C" void __pend_sv_handler () __attribute__((used, noinline));
extern "C" void __sys_tick_handler () __attribute__((used, noinline));

extern "C" void __vector_unused_irq (void) { for(;;) { ; } }
extern "C" void __nmi_handler (void) { for(;;) { ; } }
extern "C" void __hard_fault_handler (void) { for(;;) { ; } }
extern "C" void __mem_manage_handler (void) { for(;;) { ; } }
extern "C" void __bus_fault_handler (void) { for(;;) { ; } }
extern "C" void __usage_fault_handler(void) { for(;;) { ; } }
extern "C" void __svc_handler (void) { for(;;) { ; } }
extern "C" void __debug_mon_handler (void) { for(;;) { ; } }
extern "C" void __pend_sv_handler (void) { for(;;) { ; } }
extern "C" void __sys_tick_handler (void) { for(;;) { ; } }
extern "C" void __vector_unused_irq () { for(;;) { ; } }
extern "C" void __nmi_handler () { for(;;) { ; } }
extern "C" void __hard_fault_handler () { for(;;) { ; } }
extern "C" void __mem_manage_handler () { for(;;) { ; } }
extern "C" void __bus_fault_handler () { for(;;) { ; } }
extern "C" void __usage_fault_handler() { for(;;) { ; } }
extern "C" void __svc_handler () { for(;;) { ; } }
extern "C" void __debug_mon_handler () { for(;;) { ; } }
extern "C" void __pend_sv_handler () { for(;;) { ; } }
extern "C" void __sys_tick_handler () { for(;;) { ; } }

namespace
{
typedef void(*isr_type)(void);
typedef void(*isr_type)();

constexpr std::size_t number_of_interrupts = 128U;
}
Expand Down Expand Up @@ -278,3 +284,7 @@ const volatile std::array<isr_type, number_of_interrupts> __isr_vector =
nullptr // 0x01FC, dummy
}};

#if defined(__GNUC__)
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif

0 comments on commit ba25498

Please sign in to comment.