Update arm-cortex-m55-cmake.yml #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ARM Cortex-M55 Build | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| env: | |
| BUILD_TYPE: Release | |
| BUILD_FLAGS: "-mcpu=cortex-m55 -mfloat-abi=hard -mfpu=fpv5-sp-d16" | |
| FLASH_ORIGIN: "0x00000000" | |
| FLASH_LENGTH: "8192K" | |
| RAM_ORIGIN: "0x20000000" | |
| RAM_LENGTH: "4096K" | |
| STACK_SIZE: "64K" | |
| HEAP_SIZE: "1024K" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install ARM GNU Toolchain | |
| run: | | |
| wget https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz | |
| sudo tar -xf arm-gnu-toolchain-*.tar.xz -C /opt/ | |
| echo "/opt/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin" >> $GITHUB_PATH | |
| - name: Install QEMU for Cortex-M55 | |
| run: | | |
| sudo apt-get update --fix-missing | |
| sudo apt-get install -y qemu-system-arm | |
| - name: Generate toolchain script | |
| run: | | |
| cat << EOF > ${{github.workspace}}/build/toolchain.cmake | |
| set(CMAKE_SYSTEM_NAME Generic) | |
| set(CMAKE_SYSTEM_PROCESSOR arm) | |
| set(CMAKE_C_COMPILER arm-none-eabi-gcc) | |
| set(CMAKE_CXX_COMPILER arm-none-eabi-g++) | |
| set(CMAKE_ASM_COMPILER arm-none-eabi-gcc) | |
| set(CPU_FLAGS "${{ env.BUILD_FLAGS }}") | |
| set(CMAKE_C_FLAGS_INIT "\${CPU_FLAGS}") | |
| set(CMAKE_CXX_FLAGS_INIT "\${CPU_FLAGS}") | |
| set(CMAKE_ASM_FLAGS_INIT "\${CPU_FLAGS}") | |
| set(CMAKE_EXE_LINKER_FLAGS_INIT "-T ${{github.workspace}}/build/linker.ld --specs=nosys.specs ") | |
| set(THREADS_PTHREAD_ARG OFF) | |
| set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) | |
| set(BUILD_SHARED_LIBS OFF) | |
| set(gtest_disable_pthreads ON CACHE INTERNAL "") | |
| add_compile_options(-fno-exceptions -fno-rtti -fno-unwind-tables -g0 -ffunction-sections -fdata-sections) | |
| add_link_options(-Wl,--gc-sections) | |
| add_definitions(-D_POSIX_PATH_MAX=256 -D_POSIX_C_SOURCE=200809L -DGTEST_HAS_POSIX_RE=0 -DGTEST_HAS_STREAM_REDIRECTION=0 -DGTEST_OS_ESP8266=1) | |
| set(PLATFORM_SPECIAL ${{github.workspace}}/build/gtest.cpp) | |
| EOF | |
| cat ${{github.workspace}}/build/toolchain.cmake | |
| - name: Generate linker.ld | |
| run: | | |
| cat << EOF > ${{github.workspace}}/build/linker.ld | |
| MEMORY | |
| { | |
| FLASH (rx) : ORIGIN = ${{ env.FLASH_ORIGIN }}, LENGTH = ${{ env.FLASH_LENGTH }} | |
| RAM (xrw) : ORIGIN = ${{ env.RAM_ORIGIN }}, LENGTH = ${{ env.RAM_LENGTH }} | |
| } | |
| ENTRY(main) | |
| SECTIONS | |
| { | |
| .text : | |
| { | |
| *(.vectors) | |
| *(.text*) | |
| *(.rodata*) | |
| } > FLASH | |
| .ARM.exidx : | |
| { | |
| . = ALIGN(4); | |
| __exidx_start = .; | |
| *(.ARM.exidx* .gnu.linkonce.armexidx.*) | |
| . = ALIGN(4); | |
| __exidx_end = .; | |
| } > FLASH | |
| .data : | |
| { | |
| . = ALIGN(4); | |
| __data_start__ = .; | |
| *(.data*) | |
| . = ALIGN(4); | |
| __data_end__ = .; | |
| } > RAM AT > FLASH | |
| .bss : | |
| { | |
| . = ALIGN(4); | |
| __bss_start__ = .; | |
| *(.bss*) | |
| *(COMMON) | |
| . = ALIGN(4); | |
| __bss_end__ = .; | |
| } > RAM | |
| PROVIDE(end = __bss_end__); | |
| .stack : | |
| { | |
| . = ALIGN(4); | |
| . = . + ${{ env.STACK_SIZE }}; | |
| . = ALIGN(4); | |
| _estack = .; | |
| } > RAM | |
| .heap : | |
| { | |
| . = ALIGN(4); | |
| _sheap = .; | |
| . = . + ${{ env.HEAP_SIZE }}; | |
| . = ALIGN(4); | |
| _eheap = .; | |
| } > RAM | |
| } | |
| EOF | |
| cat ${{github.workspace}}/build/linker.ld | |
| - name: Generate gtest.cpp | |
| run: | | |
| cat << EOF > ${{github.workspace}}/build/gtest.cpp | |
| #include "gtest/gtest.h" | |
| extern "C" void setup(); | |
| extern "C" void loop(); | |
| extern "C" int main(int argc, char* argv[]) | |
| { | |
| setup(); | |
| loop(); | |
| return 0; | |
| } | |
| EOF | |
| cat ${{github.workspace}}/build/gtest.cpp | |
| - name: Configure CMake | |
| run: > | |
| cmake -B ${{github.workspace}}/build | |
| -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
| -DCMAKE_POLICY_VERSION_MINIMUM="3.5" | |
| -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/build/toolchain.cmake | |
| -DOPT_FORMAT_ABGR=OFF | |
| -DOPT_FORMAT_ARGB=OFF | |
| -DOPT_FORMAT_BGRA=OFF | |
| -DOPT_FORMAT_RGB=OFF | |
| -DOPT_FORMAT_BGR=OFF | |
| -DOPT_FORMAT_RGB565=OFF | |
| -DOPT_FORMAT_RGB555=OFF | |
| -DOPT_FORMAT_A8=OFF | |
| -DOPT_LOW_MEMORY=ON | |
| -DOPT_SYSTEM_MALLOC=ON | |
| -DOPT_UNITTEST=ON | |
| -DOPT_EXTENSIONS=OFF | |
| -DOPT_TESTS=OFF | |
| -DOPT_DEMOS=OFF | |
| -S ${{ github.workspace }} | |
| - name: Build | |
| run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
| - name: Run Tests with QEMU | |
| run: | | |
| qemu-system-arm \ | |
| -M mps3-an547 \ | |
| -cpu cortex-m55 \ | |
| -nographic \ | |
| -kernel ${{github.workspace}}/build/unit_tests \ | |
| -semihosting-config enable=on,target=native \ | |
| -serial mon:stdio | |