diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5f233dd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + rebase-strategy: disabled + \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef6def6..e6101a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build GetStarted example +name: Test get_started example on: workflow_dispatch: pull_request: @@ -6,36 +6,97 @@ on: push: branches: [main] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + actions: read + +env: + ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }} + jobs: - build: - name: Build - runs-on: ubuntu-latest + build-and-run: + strategy: + fail-fast: true + matrix: + compiler: [AC6, GCC, Clang] + + runs-on: ubuntu-latest + steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Setup Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: '3.10' -# - name: Cache vcpkg -# uses: actions/cache@v3 -# with: -# key: vcpkg -# path: /home/runner/.vcpkg + - name: Install system packages + run: | + sudo add-apt-repository ppa:deadsnakes/ppa + sudo apt-get install libpython3.9 libtinfo5 - name: Cache packs - uses: actions/cache@v3 + uses: actions/cache@v4 with: - key: packs + key: packs-${{ github.run_id }}-${{ matrix.compiler }} + restore-keys: | + packs- path: /home/runner/.cache/arm/packs + - name: Activate vcpkg + uses: JonatanAntoni/actions/vcpkg@main + with: + cache: "-${{ matrix.compiler }}" + + - name: Activate Arm tool license + run: | + if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then + armlm activate --code ${{ env.ARM_UBL_ACTIVATION_CODE }} + else + armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0 + fi + + - uses: ammaraskar/gcc-problem-matcher@master + if: matrix.compiler == 'GCC' + - name: Initialize CodeQL + if: matrix.compiler == 'GCC' uses: github/codeql-action/init@v2 with: languages: cpp queries: security-and-quality - - run: | - . <(curl https://aka.ms/vcpkg-init.sh -L) - vcpkg activate - cbuild get_started.csolution.yml --packs --update-rte --context .debug+avh + - name: Build + run: | + echo "Building get started example ..." + cbuild get_started.csolution.yml --packs --update-rte --context .debug+avh --toolchain ${{ matrix.compiler }} - name: Perform CodeQL Analysis + if: ${{ !cancelled() && matrix.compiler == 'GCC' }} uses: github/codeql-action/analyze@v2 + + - name: Execute + if: ${{ env.ARM_UBL_ACTIVATION_CODE }} + run: | + echo "Running get started example ..." + ext="" + case "${{ matrix.compiler }}" in + AC6) ext="axf" ;; + GCC) ext="elf";; + CLANG) ext="elf" ;; + esac + FVP_MPS2_Cortex-M3 --simlimit 10 -f vht-config.txt -a out/hello/avh/debug/hello.${ext} | tee model.log + test "$(grep "Hello World" model.log | wc -l)" -ne 10 + + - name: Deactivate Arm tool license + if: always() + run: | + if [[ -n "${{ env.ARM_UBL_ACTIVATION_CODE }}" ]]; then + armlm deactivate --code ${{ env.ARM_UBL_ACTIVATION_CODE }} + else + armlm deactivate --product KEMDK-COM0 + fi \ No newline at end of file diff --git a/README.md b/README.md index f1e5465..c9c3462 100644 --- a/README.md +++ b/README.md @@ -1,89 +1,113 @@ # Visual Studio Code get started solution + This repository builds an ELF file that prints "GetStarted World" and a counter value via semihosting output on an Arm Virtual Hardware model (Cortex-M3). -## How to setup your CMSIS Csolution CLI Environment: +## How to setup your CMSIS Csolution CLI Environment + 1. Install Microsoft vcpkg - Windows - cmd - ``` - curl -LO https://aka.ms/vcpkg-init.cmd && .\vcpkg-init.cmd - ``` + + ```cmd + curl -LO https://aka.ms/vcpkg-init.cmd && .\vcpkg-init.cmd + ``` + - powerShell - ``` - iex (iwr -useb https://aka.ms/vcpkg-init.ps1) - ``` + + ```ps1 + iex (iwr -useb https://aka.ms/vcpkg-init.ps1) + ``` + - Linux / macOS - shell - ``` - . <(curl https://aka.ms/vcpkg-init.sh -L) - ``` + + ```sh + . <(curl https://aka.ms/vcpkg-init.sh -L) + ``` 2. Enable vcpkg in your shell - Windows - cmd - ``` - %USERPROFILE%\.vcpkg\vcpkg-init.cmd - ``` + + ```cmd + %USERPROFILE%\.vcpkg\vcpkg-init.cmd + ``` + - powerShell - ``` - . ~/.vcpkg/vcpkg-init.ps1 - ``` + + ```ps1 + . ~/.vcpkg/vcpkg-init.ps1 + ``` + - Linux / macOS - shell - ``` - . ~/.vcpkg/vcpkg-init - ``` - + + ```sh + . ~/.vcpkg/vcpkg-init + ``` + 3. Activate required tools - from vcpkg-configuration.json file searched for in current directory or any parent directory - ``` - vcpkg activate - ``` + + ```sh + vcpkg activate + ``` + - from named configuration.json file + + ```sh + vcpkg activate --project mypath/vcpkg-configuration.json + ``` + + - via command line (adhoc) + + ```sh + vcpkg use arm:cmsis-toolbox microsoft:cmake microsoft:ninja arm:arm-none-eabi-gcc + ``` + +4. Deactivate previous configuration + + ```sh + vcpkg deactivate ``` - vcpkg activate --project mypath/vcpkg-configuration.json + +5. Update registries - to access latest artifact versions + + ```sh + vcpkg x-update-registry --all ``` - - via command line (adhoc) + +6. Create a new vcpkg configuration file + + ```sh + vcpkg new --application ``` - vcpkg use arm:cmsis-toolbox microsoft:cmake microsoft:ninja arm:arm-none-eabi-gcc + + ```sh + vcpkg add artifact arm:cmsis-toolbox [--version major.minor.patch] + vcpkg add artifact microsoft:cmake + vcpkg add artifact microsoft:ninja + vcpkg add artifact arm:arm-none-eabi-gcc ``` -4. Deactivate previous configuration - ``` - vcpkg deactivate - ``` + ```sh + vcpkg activate + ``` -5. Update registries - to access latest artifact versions - ``` - vcpkg x-update-registry --all - ``` +Note: The above setup uses default values instead of the Environment Variables -6. Create a new vcpkg configuration file - ``` - vcpkg new --application - ``` - ``` - vcpkg add artifact arm:cmsis-toolbox [--version major.minor.patch] - vcpkg add artifact microsoft:cmake - vcpkg add artifact microsoft:ninja - vcpkg add artifact arm:arm-none-eabi-gcc - ``` - ``` - vcpkg activate - ``` +- CMSIS_COMPILER_ROOT `./etc` directory of the CMSIS-Toolbox installation +- CMSIS_PACK_ROOT -Note: The above setup uses default values instead of the Environment Variables: - - CMSIS_COMPILER_ROOT `./etc` directory of the CMSIS-Toolbox installation - - CMSIS_PACK_ROOT + Platform | Default path + :-----------|:------------ + Linux | ${HOME}/.cache/arm/packs + Windows | ${LOCALAPPDATA}/Arm/Packs + MacOS | ${HOME}/.cache/arm/packs + WSL_Windows | ${LOCALAPPDATA}/Arm/Packs - Platform | Default path - :-----------|:------------ - Linux | ${HOME}/.cache/arm/packs - Windows | ${LOCALAPPDATA}/Arm/Packs - MacOS | ${HOME}/.cache/arm/packs - WSL_Windows | ${LOCALAPPDATA}/Arm/Packs +## How to setup your CMSIS Csolution Development Environment -## How to setup your CMSIS Csolution Development Environment: 1. Download & Install [Microsoft Visual Studio Code](https://code.visualstudio.com/download) for your operating system. 2. Launch Visual Studio Code. From the 'View' menu open 'Extensions' (ctrl+shift+x). Search for "Keil Studio Pack" and select the install button. 3. From the 'View' menu open 'Source Control'. Select 'Clone Repository' and copy the url: https://github.com/Open-CMSIS-Pack/vscode-get-started into the input dialog @@ -93,13 +117,13 @@ Note: The above setup uses default values instead of the Environment Variables: find the application elf file. Alternatively you can select 'Build' or 'Rebuild' from the context menu of the `*.csolution.yml` file of the solution context (e.g. get_started.csolution.yml) to build all contexts of the solution. -Note: Any terminal that is openened within VSCode after vcpkg got activated for the folder, will have all the above tools added to the path. +Note: Any terminal that is opened within VSCode after vcpkg got activated for the folder, will have all the above tools added to the path. This allows you to run tools from the [CMSIS-Toolbox](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-tools.md) like: - [`cpackget`](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-tools.md#cpackget-invocation) for installing and uninstalling CMSIS-Packs - [`csolution`](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-tools.md#csolution-invocation) for updating, validating and converting from the CMSIS Project Management [YML input format](https://github.com/Open-CMSIS-Pack/devtools/blob/main/tools/projmgr/docs/Manual/YML-Input-Format.md#yaml-input-format) to the CMSIS Build [XML `cprj` format](https://open-cmsis-pack.github.io/devtools/buildmgr/latest/element_cprj.html) used by `cbuildgen`. - [`cbuild`](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-tools.md#cbuild-invocation) for an orchestrated build of one or more `configurations` of a csolution. - + ## Additional Tools - Other Arm Tools available via [vcpkg](https://www.keil.arm.com/packages/) e.g.: @@ -110,7 +134,7 @@ This allows you to run tools from the [CMSIS-Toolbox](https://github.com/Open-CM The project is written in the [`CMSIS-Toolbox Project Format`](https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/YML-Input-Format.md): -- [`cdefault.yml`] is located in the ./etc directory of the CMSIS-Toolbox. It sets the default toolchain specific commandline options for supported toolchains. +- [`cdefault.yml`] is located in the ./etc directory of the CMSIS-Toolbox. It sets the default toolchain specific command line options for supported toolchains. In case a solution specific version is required, you can copy the file locally and it will be used by the tools instead. - [`get_started.csolution.yml`](./get_started.csolution.yml) lists and defines the required packs, hardware targets, build-types and projects. - [`hello/hello.cproject.yml`](./hello/hello.cproject.yml) defines components and source files. @@ -120,44 +144,48 @@ The project is written in the [`CMSIS-Toolbox Project Format`](https://github.co Use the `cbuild` command from CMSIS-Toolbox to generate and build one or all configurations of the solution: - find out which `contexts` are specified by the solution: -```bash -./ $ cbuild list contexts get_started.csolution.yml -hello.debug+avh -hello.release+avh -``` + + ```bash + ./ $ cbuild list contexts get_started.csolution.yml + hello.debug+avh + hello.release+avh + ``` - build the context `hello.debug+avh` and install the required CMSIS Packs if not installed: -```bash -./ $ cbuild get_started.csolution.yml --packs --update-rte --context hello.debug+avh -info cbuild: Build Invocation 2.2.1 (C) 2023 Arm Ltd. and Contributors -/tmp/vscode-get-started/get_started.cbuild-idx.yml - info csolution: file generated successfully -/tmp/vscode-get-started/hello/hello.debug+avh.cbuild.yml - info csolution: file generated successfully -/tmp/vscode-get-started/get_started.cbuild-pack.yml - info csolution: file is already up-to-date -/tmp/vscode-get-started/hello/hello.debug+avh.cprj - info csolution: file generated successfully -info cbuild: Processing 1 context(s) -info cbuild: Retrieve build information for context: "hello.debug+avh" -====================================================== -info cbuild: (1/1) Building context: "hello.debug+avh" - -M650: Command completed successfully. - -M652: Generated file for project build: '/tmp/vscode-get-started/tmp/hello/avh/debug/CMakeLists.txt' - : -info cbuild: build finished successfully! -``` + + ```bash + ./ $ cbuild get_started.csolution.yml --packs --update-rte --context hello.debug+avh + info cbuild: Build Invocation 2.2.1 (C) 2023 Arm Ltd. and Contributors + /tmp/vscode-get-started/get_started.cbuild-idx.yml - info csolution: file generated successfully + /tmp/vscode-get-started/hello/hello.debug+avh.cbuild.yml - info csolution: file generated successfully + /tmp/vscode-get-started/get_started.cbuild-pack.yml - info csolution: file is already up-to-date + /tmp/vscode-get-started/hello/hello.debug+avh.cprj - info csolution: file generated successfully + info cbuild: Processing 1 context(s) + info cbuild: Retrieve build information for context: "hello.debug+avh" + ====================================================== + info cbuild: (1/1) Building context: "hello.debug+avh" + + M650: Command completed successfully. + + M652: Generated file for project build: '/tmp/vscode-get-started/tmp/hello/avh/debug/CMakeLists.txt' + : + info cbuild: build finished successfully! + ``` - build the configuration `.debug+avh` using Arm Compiler 6 (AC6) -Add the Arm Compiler for Embedded 6 e.g. via vcpkg (`vcpkg use armclang`) and rebuild the context specifying `--rebuild` and the required compiler `--toolchain AC6`: -```bash -./ $ cbuild get_started.csolution.yml --context .debug+avh --packs --update-rte --rebuild --toolchain AC6 -``` + Add the Arm Compiler for Embedded 6 e.g. via vcpkg (`vcpkg use armclang`) and rebuild the context specifying + `--rebuild` and the required compiler `--toolchain AC6`: + + ```bash + ./ $ cbuild get_started.csolution.yml --context .debug+avh --packs --update-rte --rebuild --toolchain AC6 + ``` ## Execute Project -The project is configured for execution on Arm Virtual Hardware (AVH) modelling an MPS2 board running an Arm Cortex-M3 processor. +The project is configured for execution on Arm Virtual Hardware (AVH) modelling an MPS2 board running an Arm Cortex-M3 processor. This model is part of the Keil MDK Professional Edition for Windows and removes the requirement for a physical hardware board. -Note: depending on the toolchain used the extension of the application file is either `elf` (GCC) or `axf` (AC6): +Note: depending on the toolchain used the extension of the application file is either `elf` (GCC, Clang) or `axf` (AC6): ```bash ./ $ c:\Keil_v5\ARM\VHT\VHT_MPS2_Cortex-M3 -f vht-config.txt -a out\hello\avh\debug\hello.axf @@ -168,5 +196,5 @@ Alternatively the AVH-FVP models can be installed using vcpkg (`vcpkg use avh-fv Note: license required ```bash -./ $ FVP_MPS2_Cortex-M3 -f vht-config.txt -a out/hello/avh/debug/hello.elf +./ $ FVP_MPS2_Cortex-M3 -f vht-config.txt -a out/hello/avh/debug/hello.axf ``` diff --git a/hello/RTE/Device/ARMCM3/clang_linker_script.ld.src b/hello/RTE/Device/ARMCM3/clang_linker_script.ld.src new file mode 100644 index 0000000..db07749 --- /dev/null +++ b/hello/RTE/Device/ARMCM3/clang_linker_script.ld.src @@ -0,0 +1,374 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright © 2019 Keith Packard + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* ---------------------------------------------------------------------------- + Stack seal size definition + *----------------------------------------------------------------------------*/ +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +#define __STACKSEAL_SIZE ( 8 ) +#else +#define __STACKSEAL_SIZE ( 0 ) +#endif + +/* ---------------------------------------------------------------------------- + Memory definition + *----------------------------------------------------------------------------*/ +MEMORY +{ + ROM0 (rx!w) : ORIGIN = __ROM0_BASE, LENGTH = __ROM0_SIZE +#if __ROM1_SIZE > 0 + ROM1 (rx!w) : ORIGIN = __ROM1_BASE, LENGTH = __ROM1_SIZE +#endif +#if __ROM2_SIZE > 0 + ROM2 (rx!w) : ORIGIN = __ROM2_BASE, LENGTH = __ROM2_SIZE +#endif +#if __ROM3_SIZE > 0 + ROM3 (rx!w) : ORIGIN = __ROM3_BASE, LENGTH = __ROM3_SIZE +#endif + + RAM0 (w!rx) : ORIGIN = __RAM0_BASE, LENGTH = __RAM0_SIZE +#if __RAM1_SIZE > 0 + RAM1 (w!rx) : ORIGIN = __RAM1_BASE, LENGTH = __RAM1_SIZE +#endif +#if __RAM2_SIZE > 0 + RAM2 (w!rx) : ORIGIN = __RAM2_BASE, LENGTH = __RAM2_SIZE +#endif +#if __RAM3_SIZE > 0 + RAM3 (w!rx) : ORIGIN = __RAM3_BASE, LENGTH = __RAM3_SIZE +#endif +} + +ENTRY(Reset_Handler) + +PHDRS +{ + text PT_LOAD; + ram PT_LOAD; + ram_init PT_LOAD; + tls PT_TLS; +} + +SECTIONS +{ + .init : { + KEEP (*(.vectors)) + KEEP (*(.text.init.enter)) + KEEP (*(.data.init.enter)) + KEEP (*(SORT_BY_NAME(.init) SORT_BY_NAME(.init.*))) + } >ROM0 AT>ROM0 :text + + .text : { + + /* code */ + *(.text.unlikely .text.unlikely.*) + *(.text.startup .text.startup.*) + *(.text .text.* .opd .opd.*) + *(.gnu.linkonce.t.*) + KEEP (*(.fini .fini.*)) + __text_end = .; + + PROVIDE (__etext = __text_end); + PROVIDE (_etext = __text_end); + PROVIDE (etext = __text_end); + + /* read-only data */ + *(.rdata) + *(.rodata .rodata.*) + *(.gnu.linkonce.r.*) + + *(.srodata.cst16) + *(.srodata.cst8) + *(.srodata.cst4) + *(.srodata.cst2) + *(.srodata .srodata.*) + *(.data.rel.ro .data.rel.ro.*) + *(.got .got.*) + + /* Need to pre-align so that the symbols come after padding */ + . = ALIGN(8); + + /* lists of constructors and destructors */ + PROVIDE_HIDDEN ( __preinit_array_start = . ); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN ( __preinit_array_end = . ); + + PROVIDE_HIDDEN ( __init_array_start = . ); + KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP (*(.init_array .ctors)) + PROVIDE_HIDDEN ( __init_array_end = . ); + + PROVIDE_HIDDEN ( __fini_array_start = . ); + KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) + KEEP (*(.fini_array .dtors)) + PROVIDE_HIDDEN ( __fini_array_end = . ); + + } >ROM0 AT>ROM0 :text + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) + .veneers : + { + . = ALIGN(32); + KEEP(*(.gnu.sgstubs)) + } > ROM0 AT>ROM0 :text +#endif + + .toc : { + *(.toc .toc.*) + } >ROM0 AT>ROM0 :text + + /* additional sections when compiling with C++ exception support */ + + .except_ordered : { + *(.gcc_except_table *.gcc_except_table.*) + KEEP (*(.eh_frame .eh_frame.*)) + *(.ARM.extab* .gnu.linkonce.armextab.*) + } >ROM0 AT>ROM0 :text + + .except_unordered : { + . = ALIGN(8); + + PROVIDE(__exidx_start = .); + *(.ARM.exidx*) + PROVIDE(__exidx_end = .); + } >ROM0 AT>ROM0 :text + + + /* + * Data values which are preserved across reset + */ + .preserve (NOLOAD) : { + PROVIDE(__preserve_start__ = .); + KEEP(*(SORT_BY_NAME(.preserve.*))) + KEEP(*(.preserve)) + PROVIDE(__preserve_end__ = .); + } >RAM0 AT>RAM0 :ram + + .data : { + *(.data .data.*) + *(.gnu.linkonce.d.*) + + /* Need to pre-align so that the symbols come after padding */ + . = ALIGN(8); + + PROVIDE( __global_pointer$ = . + 0x800 ); + *(.sdata .sdata.* .sdata2.*) + *(.gnu.linkonce.s.*) + } >RAM0 AT>ROM0 :ram_init + PROVIDE(__data_start = ADDR(.data)); + PROVIDE(__data_source = LOADADDR(.data)); + + /* Thread local initialized data. This gets + * space allocated as it is expected to be placed + * in ram to be used as a template for TLS data blocks + * allocated at runtime. We're slightly abusing that + * by placing the data in flash where it will be copied + * into the allocate ram addresses by the existing + * data initialization code in crt0 + */ + .tdata : { + *(.tdata .tdata.* .gnu.linkonce.td.*) + PROVIDE(__data_end = .); + PROVIDE(__tdata_end = .); + } >RAM0 AT>ROM0 :tls :ram_init + PROVIDE( __tls_base = ADDR(.tdata)); + PROVIDE( __tdata_start = ADDR(.tdata)); + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_source_end = LOADADDR(.tdata) + SIZEOF(.tdata) ); + PROVIDE( __data_source_end = __tdata_source_end ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata),ALIGNOF(.tbss)) ); + + PROVIDE( __edata = __data_end ); + PROVIDE( _edata = __data_end ); + PROVIDE( edata = __data_end ); + PROVIDE( __data_size = __data_end - __data_start ); + PROVIDE( __data_source_size = __data_source_end - __data_source ); + + .tbss (NOLOAD) : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon) + PROVIDE( __tls_end = . ); + PROVIDE( __tbss_end = . ); + } >RAM0 AT>RAM0 :tls :ram + PROVIDE( __bss_start = ADDR(.tbss)); + PROVIDE( __tbss_start = ADDR(.tbss)); + PROVIDE( __tbss_offset = ADDR(.tbss) - ADDR(.tdata) ); + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - __tls_base ); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) ); + PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) ); + PROVIDE( __arm64_tls_tcb_offset = MAX(16, __tls_align) ); + + /* + * The linker special cases .tbss segments which are + * identified as segments which are not loaded and are + * thread_local. + * + * For these segments, the linker does not advance 'dot' + * across them. We actually need memory allocated for tbss, + * so we create a special segment here just to make room + */ + /* + .tbss_space (NOLOAD) : { + . = ADDR(.tbss); + . = . + SIZEOF(.tbss); + } >RAM0 AT>RAM0 :ram + */ + + .bss (NOLOAD) : { + *(.sbss*) + *(.gnu.linkonce.sb.*) + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + + /* Align the end of this section, so next can start on aligned address */ + . = ALIGN(8); + __bss_end = .; + } >RAM0 AT>RAM0 :ram + PROVIDE( __non_tls_bss_start = ADDR(.bss) ); + PROVIDE( __bss_size = __bss_end - __bss_start ); + + /* This section contains data that is not initialized during load, + or during the application's initialization sequence. */ + .noinit (NOLOAD) : { + __noinit_start__ = .; + *(.noinit) + *(.noinit.*) + + /* Align the end of this section, so next (heap) can start on aligned address */ + . = ALIGN(8); + __noinit_end__ = .; + } >RAM0 AT>RAM0 :ram + + PROVIDE( __end = . ); + PROVIDE( _end = . ); + PROVIDE( end = . ); + + /* Make the rest of memory available for heap storage */ + PROVIDE (__heap_start = __end); +#ifdef __HEAP_SIZE + PROVIDE (__heap_end = __heap_start + __HEAP_SIZE); + PROVIDE (__heap_size = __HEAP_SIZE); +#else + PROVIDE (__heap_end = __stack - __STACK_SIZE); + PROVIDE (__heap_size = __heap_end - __heap_start); +#endif + .heap (NOLOAD) : { + . += __heap_size; + } >RAM0 :ram + + /* Define a stack region to make sure it fits in memory */ + PROVIDE(__stack = ORIGIN(RAM0) + LENGTH(RAM0) - __STACKSEAL_SIZE); + PROVIDE(__stack_limit = __stack - __STACK_SIZE); + .stack (__stack_limit) (NOLOAD) : { + . += __STACK_SIZE; + } >RAM0 :ram + +#if __STACKSEAL_SIZE > 0 + PROVIDE(__stack_seal = __stack); + .stackseal (__stack) (NOLOAD) : + { + . += __STACKSEAL_SIZE; + } >RAM0 :ram +#endif + + /* Throw away C++ exception handling information */ + + /* + + /DISCARD/ : { + *(.note .note.*) + *(.eh_frame .eh_frame.*) + *(.ARM.extab* .gnu.linkonce.armextab.*) + *(.ARM.exidx*) + } + + */ + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1. */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions. */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2. */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2. */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions. */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3. */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF 5. */ + .debug_addr 0 : { *(.debug_addr) } + .debug_line_str 0 : { *(.debug_line_str) } + .debug_loclists 0 : { *(.debug_loclists) } + .debug_macro 0 : { *(.debug_macro) } + .debug_names 0 : { *(.debug_names) } + .debug_rnglists 0 : { *(.debug_rnglists) } + .debug_str_offsets 0 : { *(.debug_str_offsets) } + .debug_sup 0 : { *(.debug_sup) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } +} +/* + * Check that sections that are copied from flash to RAM have matching + * padding, so that a single memcpy() of __data_size copies the correct bytes. + */ +ASSERT( __data_size == __data_source_size, + "ERROR: .data/.tdata flash size does not match RAM size"); diff --git a/hello/RTE/Device/ARMCM3/regions_ARMCM3.h b/hello/RTE/Device/ARMCM3/regions_ARMCM3.h new file mode 100644 index 0000000..342bf64 --- /dev/null +++ b/hello/RTE/Device/ARMCM3/regions_ARMCM3.h @@ -0,0 +1,60 @@ +#ifndef REGIONS_ARMCM3_H +#define REGIONS_ARMCM3_H + + +//-------- <<< Use Configuration Wizard in Context Menu >>> -------------------- + +// Device pack: ARM::Cortex_DFP@1.0.0 +// Device pack used to generate this file + +// ROM Configuration +// ======================= +// ROM=<__ROM0> +// Base address <0x0-0xFFFFFFFF:8> +// Defines base address of memory region. +// Default: 0x00000000 +#define __ROM0_BASE 0x00000000 +// Region size [bytes] <0x0-0xFFFFFFFF:8> +// Defines size of memory region. +// Default: 0x00040000 +#define __ROM0_SIZE 0x00040000 +// Default region +// Enables memory region globally for the application. +#define __ROM0_DEFAULT 1 +// Startup +// Selects region to be used for startup code. +#define __ROM0_STARTUP 1 +// + +// + +// RAM Configuration +// ======================= +// RAM=<__RAM0> +// Base address <0x0-0xFFFFFFFF:8> +// Defines base address of memory region. +// Default: 0x20000000 +#define __RAM0_BASE 0x20000000 +// Region size [bytes] <0x0-0xFFFFFFFF:8> +// Defines size of memory region. +// Default: 0x00020000 +#define __RAM0_SIZE 0x00020000 +// Default region +// Enables memory region globally for the application. +#define __RAM0_DEFAULT 1 +// No zero initialize +// Excludes region from zero initialization. +#define __RAM0_NOINIT 0 +// + +// + +// Stack / Heap Configuration +// Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +// Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +#define __STACK_SIZE 0x00000200 +#define __HEAP_SIZE 0x00000C00 +// + + +#endif /* REGIONS_ARMCM3_H */