diff --git a/boards/MicroBit_v2/microbit_v2_zfp.gpr b/boards/MicroBit_v2/microbit_v2_zfp.gpr new file mode 100644 index 000000000..01378ff12 --- /dev/null +++ b/boards/MicroBit_v2/microbit_v2_zfp.gpr @@ -0,0 +1,257 @@ +-- This project file was generated by the Ada_Drivers_Library project wizard script +library project MicroBit_v2_ZFP is + + type Build_Type is ("Debug", "Production"); + Build : Build_Type := external ("ADL_BUILD", "Debug"); + + type Build_Checks_Type is ("Disabled", "Enabled"); + Build_Checks : Build_Checks_Type := external ("ADL_BUILD_CHECKS", "Disabled"); + + -- Target architecture + Target := Project'Target; + + -- Callgraph info is not available on all architectures + Callgraph_Switch := (); + case Target is + when "riscv32-unknown-elf" => null; + when others => Callgraph_Switch := ("-fcallgraph-info=su"); + end case; + + Build_Checks_Switches := (); + case Build_Checks is + when "Disabled" => null; + when others => + Build_Checks_Switches := + ("-gnaty", "-gnatyM120", "-gnatyO", -- Style checks + "-gnatwe"); -- Warnings as errors + end case; + + package Compiler is + case Build is + when "Production" => + for Default_Switches ("Ada") use + ("-O3", -- Optimization + "-gnatp", -- Supress checks + "-gnatn"); -- Enable inlining + when "Debug" => + for Default_Switches ("Ada") use + ("-O0", -- No optimization + "-gnata") -- Enable assertions + & Callgraph_Switch; + end case; + + for Default_Switches ("ada") use Compiler'Default_Switches ("Ada") & + Callgraph_Switch & + Build_Checks_Switches & + ("-g", -- Debug info + "-gnatwa", -- All warnings + "-gnatw_A", -- Turn off warnings for anonymous allocators + "-gnatQ", -- Don't quit. Generate ALI and tree files even if illegalities + "-gnatw.X", -- Disable warnings for No_Exception_Propagation + "-ffunction-sections", -- Create a linker section for each function + "-fdata-sections"); -- Create a linker section for each data + end Compiler; + + + for Languages use ("Ada", "Asm_CPP"); + for Create_Missing_Dirs use "True"; + for Object_Dir use "obj/zfp_" & Build; + for Library_Dir use "obj/zfp_lib_" & Build; + for Library_Kind use "static"; + for Library_Name use "ada_drivers_library"; + + Linker_Switches := ("-T", Project'Project_dir & "/src/zfp/link.ld"); + for Target use "arm-eabi"; + for Runtime ("Ada") use "zfp-cortex-m4f"; + + package Device_Configuration is + for CPU_Name use "ARM Cortex-M4F"; + for Number_Of_Interrupts use "128"; + for Interrupt ("0") use "adl_irq"; + for Interrupt ("1") use "adl_irq"; + for Interrupt ("2") use "adl_irq"; + for Interrupt ("3") use "adl_irq"; + for Interrupt ("4") use "adl_irq"; + for Interrupt ("5") use "adl_irq"; + for Interrupt ("6") use "adl_irq"; + for Interrupt ("7") use "adl_irq"; + for Interrupt ("8") use "adl_irq"; + for Interrupt ("9") use "adl_irq"; + for Interrupt ("10") use "adl_irq"; + for Interrupt ("11") use "adl_irq"; + for Interrupt ("12") use "adl_irq"; + for Interrupt ("13") use "adl_irq"; + for Interrupt ("14") use "adl_irq"; + for Interrupt ("15") use "adl_irq"; + for Interrupt ("16") use "adl_irq"; + for Interrupt ("17") use "adl_irq"; + for Interrupt ("18") use "adl_irq"; + for Interrupt ("19") use "adl_irq"; + for Interrupt ("20") use "adl_irq"; + for Interrupt ("21") use "adl_irq"; + for Interrupt ("22") use "adl_irq"; + for Interrupt ("23") use "adl_irq"; + for Interrupt ("24") use "adl_irq"; + for Interrupt ("25") use "adl_irq"; + for Interrupt ("26") use "adl_irq"; + for Interrupt ("27") use "adl_irq"; + for Interrupt ("28") use "adl_irq"; + for Interrupt ("29") use "adl_irq"; + for Interrupt ("30") use "adl_irq"; + for Interrupt ("31") use "adl_irq"; + for Interrupt ("32") use "adl_irq"; + for Interrupt ("33") use "adl_irq"; + for Interrupt ("34") use "adl_irq"; + for Interrupt ("35") use "adl_irq"; + for Interrupt ("36") use "adl_irq"; + for Interrupt ("37") use "adl_irq"; + for Interrupt ("38") use "adl_irq"; + for Interrupt ("39") use "adl_irq"; + for Interrupt ("40") use "adl_irq"; + for Interrupt ("41") use "adl_irq"; + for Interrupt ("42") use "adl_irq"; + for Interrupt ("43") use "adl_irq"; + for Interrupt ("44") use "adl_irq"; + for Interrupt ("45") use "adl_irq"; + for Interrupt ("46") use "adl_irq"; + for Interrupt ("47") use "adl_irq"; + for Interrupt ("48") use "adl_irq"; + for Interrupt ("49") use "adl_irq"; + for Interrupt ("50") use "adl_irq"; + for Interrupt ("51") use "adl_irq"; + for Interrupt ("52") use "adl_irq"; + for Interrupt ("53") use "adl_irq"; + for Interrupt ("54") use "adl_irq"; + for Interrupt ("55") use "adl_irq"; + for Interrupt ("56") use "adl_irq"; + for Interrupt ("57") use "adl_irq"; + for Interrupt ("58") use "adl_irq"; + for Interrupt ("59") use "adl_irq"; + for Interrupt ("60") use "adl_irq"; + for Interrupt ("61") use "adl_irq"; + for Interrupt ("62") use "adl_irq"; + for Interrupt ("63") use "adl_irq"; + for Interrupt ("64") use "adl_irq"; + for Interrupt ("65") use "adl_irq"; + for Interrupt ("66") use "adl_irq"; + for Interrupt ("67") use "adl_irq"; + for Interrupt ("68") use "adl_irq"; + for Interrupt ("69") use "adl_irq"; + for Interrupt ("70") use "adl_irq"; + for Interrupt ("71") use "adl_irq"; + for Interrupt ("72") use "adl_irq"; + for Interrupt ("73") use "adl_irq"; + for Interrupt ("74") use "adl_irq"; + for Interrupt ("75") use "adl_irq"; + for Interrupt ("76") use "adl_irq"; + for Interrupt ("77") use "adl_irq"; + for Interrupt ("78") use "adl_irq"; + for Interrupt ("79") use "adl_irq"; + for Interrupt ("80") use "adl_irq"; + for Interrupt ("81") use "adl_irq"; + for Interrupt ("82") use "adl_irq"; + for Interrupt ("83") use "adl_irq"; + for Interrupt ("84") use "adl_irq"; + for Interrupt ("85") use "adl_irq"; + for Interrupt ("86") use "adl_irq"; + for Interrupt ("87") use "adl_irq"; + for Interrupt ("88") use "adl_irq"; + for Interrupt ("89") use "adl_irq"; + for Interrupt ("90") use "adl_irq"; + for Interrupt ("91") use "adl_irq"; + for Interrupt ("92") use "adl_irq"; + for Interrupt ("93") use "adl_irq"; + for Interrupt ("94") use "adl_irq"; + for Interrupt ("95") use "adl_irq"; + for Interrupt ("96") use "adl_irq"; + for Interrupt ("97") use "adl_irq"; + for Interrupt ("98") use "adl_irq"; + for Interrupt ("99") use "adl_irq"; + for Interrupt ("100") use "adl_irq"; + for Interrupt ("101") use "adl_irq"; + for Interrupt ("102") use "adl_irq"; + for Interrupt ("103") use "adl_irq"; + for Interrupt ("104") use "adl_irq"; + for Interrupt ("105") use "adl_irq"; + for Interrupt ("106") use "adl_irq"; + for Interrupt ("107") use "adl_irq"; + for Interrupt ("108") use "adl_irq"; + for Interrupt ("109") use "adl_irq"; + for Interrupt ("110") use "adl_irq"; + for Interrupt ("111") use "adl_irq"; + for Interrupt ("112") use "adl_irq"; + for Interrupt ("113") use "adl_irq"; + for Interrupt ("114") use "adl_irq"; + for Interrupt ("115") use "adl_irq"; + for Interrupt ("116") use "adl_irq"; + for Interrupt ("117") use "adl_irq"; + for Interrupt ("118") use "adl_irq"; + for Interrupt ("119") use "adl_irq"; + for Interrupt ("120") use "adl_irq"; + for Interrupt ("121") use "adl_irq"; + for Interrupt ("122") use "adl_irq"; + for Interrupt ("123") use "adl_irq"; + for Interrupt ("124") use "adl_irq"; + for Interrupt ("125") use "adl_irq"; + for Interrupt ("126") use "adl_irq"; + for Interrupt ("127") use "adl_irq"; + + for Memories use ("flash", "ram"); + + for Mem_Kind ("flash") use "rom"; + for Address ("flash") use "0x00000000"; + for Size ("flash") use "512K"; + + for Mem_Kind ("ram") use "ram"; + for Address ("ram") use "0x20000000"; + for Size ("ram") use "128K"; + + for Boot_Memory use "flash"; + end Device_Configuration; + + Architecture := "ARM"; -- From board definition + Board := "MicroBit_v2"; -- From command line + Boot_Memory := "flash"; -- From default value + CPU_Core := "ARM Cortex-M4F"; -- From mcu definition + Device_Family := "nRF52"; -- From board definition + Device_Name := "nRF52833xxAA"; -- From board definition + Has_Custom_Memory_Area_1 := "False"; -- From default value + Has_Ravenscar_Full_Runtime := "False"; -- From board definition + Has_Ravenscar_SFP_Runtime := "False"; -- From board definition + Has_ZFP_Runtime := "True"; -- From board definition + Max_Mount_Name_Length := "128"; -- From default value + Max_Mount_Points := "2"; -- From default value + Max_Path_Length := "1024"; -- From default value + Number_Of_Interrupts := "128"; -- From MCU definition + Runtime_Name := "zfp-cortex-m4f"; -- From default value + Runtime_Name_Suffix := "cortex-m4f"; -- From board definition + Runtime_Profile := "zfp"; -- From command line + Use_Startup_Gen := "True"; -- From command line + Vendor := "Nordic"; -- From board definition + + -- Project source directories + Src_Dirs_Root := "../.."; + for Source_Dirs use ( + Src_Dirs_Root & "/hal/src/", -- From HAL config + Src_Dirs_Root & "/boards/MicroBit_v2/src/", -- From board definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/cm4f", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/fpu", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/nocache", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/nvic_cm4_cm7", -- From arch definition + Src_Dirs_Root & "/arch/ARM/Nordic/devices/nrf52", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/drivers/nrf_common", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/drivers/nrf52", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/svd/nrf52/", -- From MCU definition + Src_Dirs_Root & "/middleware/src/filesystem", -- From middleware config + Src_Dirs_Root & "/middleware/src/BLE", -- From middleware config + Src_Dirs_Root & "/middleware/src/utils", -- From middleware config + Src_Dirs_Root & "/middleware/src/audio", -- From middleware config + Src_Dirs_Root & "/middleware/src/monitor", -- From middleware config + Src_Dirs_Root & "/middleware/src/bitmap", -- From middleware config + Src_Dirs_Root & "/middleware/src/command_line", -- From middleware config + Src_Dirs_Root & "/middleware/src/sdmmc", -- From middleware config + Src_Dirs_Root & "/middleware/src/neopixel", -- From middleware config + Src_Dirs_Root & "/components/src/**", -- From components config + "src/zfp/"); +end MicroBit_v2_ZFP; diff --git a/boards/MicroBit_v2/src/microbit.ads b/boards/MicroBit_v2/src/microbit.ads new file mode 100644 index 000000000..f9bd08a8d --- /dev/null +++ b/boards/MicroBit_v2/src/microbit.ads @@ -0,0 +1,34 @@ +------------------------------------------------------------------------------ +-- -- +-- Copyright (C) 2021, AdaCore -- +-- -- +-- 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. -- +-- -- +------------------------------------------------------------------------------ + +package MicroBit is + +end MicroBit; diff --git a/boards/MicroBit_v2/src/zfp/adl_config.ads b/boards/MicroBit_v2/src/zfp/adl_config.ads new file mode 100644 index 000000000..9460a4cc6 --- /dev/null +++ b/boards/MicroBit_v2/src/zfp/adl_config.ads @@ -0,0 +1,22 @@ +-- This package was generated by the Ada_Drivers_Library project wizard script +package ADL_Config is + Architecture : constant String := "ARM"; -- From board definition + Board : constant String := "MicroBit_v2"; -- From command line + Boot_Memory : constant String := "flash"; -- From default value + CPU_Core : constant String := "ARM Cortex-M4F"; -- From mcu definition + Device_Family : constant String := "nRF52"; -- From board definition + Device_Name : constant String := "nRF52833xxAA"; -- From board definition + Has_Custom_Memory_Area_1 : constant Boolean := False; -- From default value + Has_Ravenscar_Full_Runtime : constant String := "False"; -- From board definition + Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition + Has_ZFP_Runtime : constant String := "True"; -- From board definition + Max_Mount_Name_Length : constant := 128; -- From default value + Max_Mount_Points : constant := 2; -- From default value + Max_Path_Length : constant := 1024; -- From default value + Number_Of_Interrupts : constant := 128; -- From MCU definition + Runtime_Name : constant String := "zfp-cortex-m4f"; -- From default value + Runtime_Name_Suffix : constant String := "cortex-m4f"; -- From board definition + Runtime_Profile : constant String := "zfp"; -- From command line + Use_Startup_Gen : constant Boolean := True; -- From command line + Vendor : constant String := "Nordic"; -- From board definition +end ADL_Config; diff --git a/boards/MicroBit_v2/src/zfp/crt0.S b/boards/MicroBit_v2/src/zfp/crt0.S new file mode 100644 index 000000000..580fa531e --- /dev/null +++ b/boards/MicroBit_v2/src/zfp/crt0.S @@ -0,0 +1,549 @@ + .syntax unified + +#if defined(__SOFTFP__) + .cpu cortex-m0 +#else + /* FPU support means at least cortex-m4 compatibility */ + .cpu cortex-m4 +#endif + + .thumb + + .text + .globl __vectors + .p2align 9 + .section .vectors,"a" +__vectors: + /* Cortex-M core interrupts */ + .word __stack_end /* stack top address */ + .word Reset_Handler /* 1 Reset */ + .word NMI_Handler /* 2 NMI. */ + .word HardFault_Handler /* 3 Hard fault. */ + .word MemoryManagement_Handler /* 4 Mem manage. */ + .word BusFault_Handler /* 5 Bus fault. */ + .word UsageFault_Handler /* 6 Usage fault. */ + .word Reserved_Handler /* 7 reserved. */ + .word Reserved_Handler /* 8 reserved. */ + .word Reserved_Handler /* 9 reserved. */ + .word Reserved_Handler /* 10 reserved. */ + .word SVC_Handler /* 11 SVCall. */ + .word DebugMon_Handler /* 12 Breakpoint. */ + .word Reserved_Handler /* 13 reserved. */ + .word PendSV_Handler /* 14 PendSV. */ + .word SysTick_Handler /* 15 Systick. */ + /* MCU interrupts */ + .word __adl_irq_handler /* 0 */ + .word __adl_irq_handler /* 1 */ + .word __adl_irq_handler /* 2 */ + .word __adl_irq_handler /* 3 */ + .word __adl_irq_handler /* 4 */ + .word __adl_irq_handler /* 5 */ + .word __adl_irq_handler /* 6 */ + .word __adl_irq_handler /* 7 */ + .word __adl_irq_handler /* 8 */ + .word __adl_irq_handler /* 9 */ + .word __adl_irq_handler /* 10 */ + .word __adl_irq_handler /* 11 */ + .word __adl_irq_handler /* 12 */ + .word __adl_irq_handler /* 13 */ + .word __adl_irq_handler /* 14 */ + .word __adl_irq_handler /* 15 */ + .word __adl_irq_handler /* 16 */ + .word __adl_irq_handler /* 17 */ + .word __adl_irq_handler /* 18 */ + .word __adl_irq_handler /* 19 */ + .word __adl_irq_handler /* 20 */ + .word __adl_irq_handler /* 21 */ + .word __adl_irq_handler /* 22 */ + .word __adl_irq_handler /* 23 */ + .word __adl_irq_handler /* 24 */ + .word __adl_irq_handler /* 25 */ + .word __adl_irq_handler /* 26 */ + .word __adl_irq_handler /* 27 */ + .word __adl_irq_handler /* 28 */ + .word __adl_irq_handler /* 29 */ + .word __adl_irq_handler /* 30 */ + .word __adl_irq_handler /* 31 */ + .word __adl_irq_handler /* 32 */ + .word __adl_irq_handler /* 33 */ + .word __adl_irq_handler /* 34 */ + .word __adl_irq_handler /* 35 */ + .word __adl_irq_handler /* 36 */ + .word __adl_irq_handler /* 37 */ + .word __adl_irq_handler /* 38 */ + .word __adl_irq_handler /* 39 */ + .word __adl_irq_handler /* 40 */ + .word __adl_irq_handler /* 41 */ + .word __adl_irq_handler /* 42 */ + .word __adl_irq_handler /* 43 */ + .word __adl_irq_handler /* 44 */ + .word __adl_irq_handler /* 45 */ + .word __adl_irq_handler /* 46 */ + .word __adl_irq_handler /* 47 */ + .word __adl_irq_handler /* 48 */ + .word __adl_irq_handler /* 49 */ + .word __adl_irq_handler /* 50 */ + .word __adl_irq_handler /* 51 */ + .word __adl_irq_handler /* 52 */ + .word __adl_irq_handler /* 53 */ + .word __adl_irq_handler /* 54 */ + .word __adl_irq_handler /* 55 */ + .word __adl_irq_handler /* 56 */ + .word __adl_irq_handler /* 57 */ + .word __adl_irq_handler /* 58 */ + .word __adl_irq_handler /* 59 */ + .word __adl_irq_handler /* 60 */ + .word __adl_irq_handler /* 61 */ + .word __adl_irq_handler /* 62 */ + .word __adl_irq_handler /* 63 */ + .word __adl_irq_handler /* 64 */ + .word __adl_irq_handler /* 65 */ + .word __adl_irq_handler /* 66 */ + .word __adl_irq_handler /* 67 */ + .word __adl_irq_handler /* 68 */ + .word __adl_irq_handler /* 69 */ + .word __adl_irq_handler /* 70 */ + .word __adl_irq_handler /* 71 */ + .word __adl_irq_handler /* 72 */ + .word __adl_irq_handler /* 73 */ + .word __adl_irq_handler /* 74 */ + .word __adl_irq_handler /* 75 */ + .word __adl_irq_handler /* 76 */ + .word __adl_irq_handler /* 77 */ + .word __adl_irq_handler /* 78 */ + .word __adl_irq_handler /* 79 */ + .word __adl_irq_handler /* 80 */ + .word __adl_irq_handler /* 81 */ + .word __adl_irq_handler /* 82 */ + .word __adl_irq_handler /* 83 */ + .word __adl_irq_handler /* 84 */ + .word __adl_irq_handler /* 85 */ + .word __adl_irq_handler /* 86 */ + .word __adl_irq_handler /* 87 */ + .word __adl_irq_handler /* 88 */ + .word __adl_irq_handler /* 89 */ + .word __adl_irq_handler /* 90 */ + .word __adl_irq_handler /* 91 */ + .word __adl_irq_handler /* 92 */ + .word __adl_irq_handler /* 93 */ + .word __adl_irq_handler /* 94 */ + .word __adl_irq_handler /* 95 */ + .word __adl_irq_handler /* 96 */ + .word __adl_irq_handler /* 97 */ + .word __adl_irq_handler /* 98 */ + .word __adl_irq_handler /* 99 */ + .word __adl_irq_handler /* 100 */ + .word __adl_irq_handler /* 101 */ + .word __adl_irq_handler /* 102 */ + .word __adl_irq_handler /* 103 */ + .word __adl_irq_handler /* 104 */ + .word __adl_irq_handler /* 105 */ + .word __adl_irq_handler /* 106 */ + .word __adl_irq_handler /* 107 */ + .word __adl_irq_handler /* 108 */ + .word __adl_irq_handler /* 109 */ + .word __adl_irq_handler /* 110 */ + .word __adl_irq_handler /* 111 */ + .word __adl_irq_handler /* 112 */ + .word __adl_irq_handler /* 113 */ + .word __adl_irq_handler /* 114 */ + .word __adl_irq_handler /* 115 */ + .word __adl_irq_handler /* 116 */ + .word __adl_irq_handler /* 117 */ + .word __adl_irq_handler /* 118 */ + .word __adl_irq_handler /* 119 */ + .word __adl_irq_handler /* 120 */ + .word __adl_irq_handler /* 121 */ + .word __adl_irq_handler /* 122 */ + .word __adl_irq_handler /* 123 */ + .word __adl_irq_handler /* 124 */ + .word __adl_irq_handler /* 125 */ + .word __adl_irq_handler /* 126 */ + .word __adl_irq_handler /* 127 */ + + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + .weak __adl_irq_handler + .thumb_set __adl_irq_handler,__common_int_handler + + .text + + .weak __unknown_interrupt_handler + .thumb_set __unknown_interrupt_handler,__common_int_handler + +.macro weak_handler name + .thumb_func +.weak \name +.type \name, %function +\name: +0: b 0b + .size \name, . - \name +.endm + +weak_handler NMI_Handler +weak_handler HardFault_Handler +weak_handler MemoryManagement_Handler +weak_handler BusFault_Handler +weak_handler UsageFault_Handler +weak_handler Reserved_Handler +weak_handler SVC_Handler +weak_handler DebugMon_Handler +weak_handler PendSV_Handler +weak_handler SysTick_Handler +weak_handler __common_int_handler + + /*********/ + /* .data */ + /*********/ + .section .data.argv +argv_str: + .ascii "main\0" + + .align 4 +argv: + .word argv_str + .word 0 + + /*****************/ + /* Reset_Handler */ + /*****************/ + + .text + .thumb_func + .globl Reset_Handler + +Reset_Handler: + + /* Set the stack pointer */ + ldr r1,=__stack_end + mov sp, r1 + + /* Copy .data */ + .thumb_func +_startup_copy_data: + ldr r0,=__data_start + ldr r1,=__data_words + ldr r2,=__data_load + cmp r1,#0 + beq 1f +0: ldr r4,[r2] + str r4,[r0] + adds r2,#4 + adds r0,#4 + subs r1,r1,#1 + bne 0b +1: + .size _startup_copy_data, . - _startup_copy_data + + /* Clear .bss */ + .thumb_func +_startup_clear_bss: + ldr r0,=__bss_start + ldr r1,=__bss_words + movs r2,#0 + cmp r1,#0 + beq 1f +0: str r2,[r0] + adds r0,#4 + subs r1,r1,#1 + bne 0b +1: + .size _startup_clear_bss, . - _startup_clear_bss + +#if !defined(__SOFTFP__) + /**************/ + /* Enable FPU */ + /**************/ + + movw r0,#0xED88 + movt r0,#0xE000 + ldr r1,[r0] + orr r1,r1,#(0xF << 20) + str r1,[r0] + + dsb + isb +#endif + + /* Call static constructors */ +.weak __libc_init_array + ldr r5,=__libc_init_array + cmp r5,#0 + beq .skip_libc_init + blx r5 +.skip_libc_init: + + /* Call main, with argc, argv */ + movs r0,#1 + ldr r1,=argv + bl main + + /* Save main's return value */ + mov r4, r0 + + /* static destructors */ +.weak __libc_fini_array + ldr r5,=__libc_fini_array + cmp r5,#0 + beq .skip_libc_fini + blx r5 +.skip_libc_fini: + + /* Restore main's return value */ + mov r0, r4 + + bl _exit + bl Reset_Handler + .size Reserved_Handler, . - Reset_Handler \ No newline at end of file diff --git a/boards/MicroBit_v2/src/zfp/link.ld b/boards/MicroBit_v2/src/zfp/link.ld new file mode 100644 index 000000000..b4a7aaea5 --- /dev/null +++ b/boards/MicroBit_v2/src/zfp/link.ld @@ -0,0 +1,156 @@ +/* This is a ARM specific version of this file */ + +/* This script replaces ld's default linker script, providing the + appropriate memory map and output format. */ + +SEARCH_DIR(.) +__DYNAMIC = 0; + +_DEFAULT_STACK_SIZE = 0x1000; + +ENTRY(Reset_Handler); + +MEMORY +{ + flash (rx) : ORIGIN = 0x0, LENGTH = 0x80000 + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 +} + +/* + * Boot memory (.text, .ro_data, interrupt vector): flash + * Main RAM memory (.data, .bss, stacks, interrupt stacks): flash + */ + +SECTIONS +{ + + /*********/ + /* flash */ + /*********/ + .text : + { + KEEP (*(.vectors)) + *(.text .text.* .gnu.linkonce.t*) + *(.gnu.warning) + } > flash + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > flash + /* .ARM.exidx is 4-bytes aligned, so __exidx_start needs to be + aligned too. Note that assigning the location counter also makes + ld attach the following symbols to the next section (instead of the + previous section which is the default), so will properly + consider the location counter of .ARM.exidx for __exidx_start and + __exidx_end and not the previous section's one. */ + . = ALIGN(0x4); + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > flash + PROVIDE_HIDDEN (__exidx_end = .); + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } > flash + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } > flash + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } > flash + + .rodata : + { + *(.lit) + *(.rodata .rodata.* .gnu.linkonce.r*) + . = ALIGN(0x4); + __rom_end = .; + } > flash + /****************/ + /* End of flash */ + /****************/ + + /*******/ + /* ram */ + /*******/ + __data_load = LOADADDR(.data); + .data : + { + __data_start = .; + *(.data .data.* .gnu.linkonce.d*) + + /* Ensure that the end of the data section is always word aligned. + Initial values are stored in 4-bytes blocks so we must guarantee + that these blocks do not fall out the section (otherwise they are + truncated and the initial data for the last block are lost). */ + + . = ALIGN(0x4); + __data_end = .; + } > ram AT> flash + __data_words = (__data_end - __data_start) >> 2; + + .bss (NOLOAD): { + . = ALIGN(0x8); + __bss_start = .; + + *(.bss .bss.*) + *(COMMON) + + . = ALIGN(0x8); /* Align the stack to 64 bits */ + __bss_end = .; + + __interrupt_stack_start = .; + *(.interrupt_stacks) + . = ALIGN(0x8); + __interrupt_stack_end = .; + + __stack_start = .; + . += DEFINED (__stack_size) ? __stack_size : _DEFAULT_STACK_SIZE; + . = ALIGN(0x8); + __stack_end = .; + + _end = .; + __heap_start = .; + __heap_end = ORIGIN(ram) + LENGTH(ram); + } > ram + __bss_words = (__bss_end - __bss_start) >> 2; + /**************/ + /* End of ram */ + /**************/ + + /* 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_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) } +} \ No newline at end of file diff --git a/boards/board_projects_generator.py b/boards/board_projects_generator.py index 45d6022f8..0694c521b 100755 --- a/boards/board_projects_generator.py +++ b/boards/board_projects_generator.py @@ -9,6 +9,7 @@ 'HiFive1_rev_B': { 'rts_profiles': ['zfp']}, 'Unleashed': { 'rts_profiles': ['zfp', 'ravenscar-sfp', 'ravenscar-full']}, 'MicroBit': { 'rts_profiles': ['zfp']}, + 'MicroBit_v2': { 'rts_profiles': ['zfp']}, 'NRF52_DK': { 'rts_profiles': ['zfp']}, 'Native': { 'rts_profiles': ['none']}, 'OpenMV2': { 'rts_profiles': ['ravenscar-sfp', 'ravenscar-full']}, @@ -28,6 +29,7 @@ 'HiFive1_rev_B': 'HiFive1_rev_B', 'Unleashed': 'Unleashed', 'MicroBit': 'MicroBit', + 'MicroBit_v2': 'MicroBit_v2', 'NRF52_DK': 'NRF52_DK', 'Native': 'native', 'OpenMV2': 'OpenMV2', @@ -40,7 +42,7 @@ 'Feather_STM32F405': 'feather_stm32f405', 'STM32_H405': 'stm32_h405'} -USE_STARTUP_GEN = ['HiFive1', 'HiFive1_rev_B', 'MicroBit', 'NRF52_DK'] +USE_STARTUP_GEN = ['HiFive1', 'HiFive1_rev_B', 'MicroBit', 'MicroBit_v2', 'NRF52_DK'] def gen_project(board_name, rts): assert board_name is not None, "board is undefined" diff --git a/examples/MicroBit_v2/text_scrolling/README.md b/examples/MicroBit_v2/text_scrolling/README.md new file mode 100644 index 000000000..f81de581a --- /dev/null +++ b/examples/MicroBit_v2/text_scrolling/README.md @@ -0,0 +1,39 @@ +Text Scrolling Example +====================== + +In this example we will see how to display text on the LED matrix of the +micro:bit. + +Code +==== + +To display text on the LED matrix, we will use the procedure `Display` of the +`MicroBit.Display` package. + + +```ada + procedure Display (Str : String) + with Pre => Str'Length <= Scroll_Text_Max_Length; +``` + +Arguments: + + - Str : The text to be displayed on the LED matrix + +Precondition: + +The procedure `Display` has a precondition that the length of the text cannot +be more than `Scroll_Text_Max_Length` (128 characters). + +Here is the code: +```ada +with MicroBit.Display; + +procedure Main is +begin + + loop + MicroBit.Display.Display ("Make with Ada! "); + end loop; +end Main; +``` diff --git a/examples/MicroBit_v2/text_scrolling/src/main.adb b/examples/MicroBit_v2/text_scrolling/src/main.adb new file mode 100644 index 000000000..077acc3cf --- /dev/null +++ b/examples/MicroBit_v2/text_scrolling/src/main.adb @@ -0,0 +1,41 @@ +------------------------------------------------------------------------------ +-- -- +-- Copyright (C) 2021, AdaCore -- +-- -- +-- 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. -- +-- -- +------------------------------------------------------------------------------ + +-- with MicroBit.Display; + +procedure Main is +begin + + loop + null; + -- MicroBit.Display.Display ("Make with Ada! "); + end loop; +end Main; diff --git a/examples/MicroBit_v2/text_scrolling/text_scrolling.gpr b/examples/MicroBit_v2/text_scrolling/text_scrolling.gpr new file mode 100644 index 000000000..accd43957 --- /dev/null +++ b/examples/MicroBit_v2/text_scrolling/text_scrolling.gpr @@ -0,0 +1,29 @@ +with "../../../boards/MicroBit_v2/microbit_v2_zfp.gpr"; + +project Text_Scrolling is + + for Runtime ("ada") use MicroBit_V2_ZFP'Runtime ("Ada"); + for Target use "arm-eabi"; + for Main use ("main.adb"); + for Languages use ("Ada"); + for Source_Dirs use ("src"); + for Object_Dir use "obj"; + for Create_Missing_Dirs use "True"; + + package Compiler renames MicroBit_V2__ZFP.Compiler; + + package Linker is + for Default_Switches ("Ada") use + MicroBit_V2__ZFP.Linker_Switches & + ("-Wl,--print-memory-usage", + "-Wl,--gc-sections", + "-U__gnat_irq_trap"); + end Linker; + + package Ide is + for Program_Host use ":1234"; + for Communication_Protocol use "remote"; + for Connection_Tool use "pyocd"; + end Ide; + +end Text_Scrolling; diff --git a/scripts/Ada_Drivers_Library/ada_drivers_library.gpr b/scripts/Ada_Drivers_Library/ada_drivers_library.gpr new file mode 100644 index 000000000..ae5514790 --- /dev/null +++ b/scripts/Ada_Drivers_Library/ada_drivers_library.gpr @@ -0,0 +1,160 @@ +-- This project file was generated by the Ada_Drivers_Library project wizard script +library project Ada_Drivers_Library is + + type Build_Type is ("Debug", "Production"); + Build : Build_Type := external ("ADL_BUILD", "Debug"); + + type Build_Checks_Type is ("Disabled", "Enabled"); + Build_Checks : Build_Checks_Type := external ("ADL_BUILD_CHECKS", "Disabled"); + + -- Target architecture + Target := Project'Target; + + -- Callgraph info is not available on all architectures + Callgraph_Switch := (); + case Target is + when "riscv32-unknown-elf" => null; + when others => Callgraph_Switch := ("-fcallgraph-info=su"); + end case; + + Build_Checks_Switches := (); + case Build_Checks is + when "Disabled" => null; + when others => + Build_Checks_Switches := + ("-gnaty", "-gnatyM120", "-gnatyO", -- Style checks + "-gnatwe"); -- Warnings as errors + end case; + + package Compiler is + case Build is + when "Production" => + for Default_Switches ("Ada") use + ("-O3", -- Optimization + "-gnatp", -- Supress checks + "-gnatn"); -- Enable inlining + when "Debug" => + for Default_Switches ("Ada") use + ("-O0", -- No optimization + "-gnata") -- Enable assertions + & Callgraph_Switch; + end case; + + for Default_Switches ("ada") use Compiler'Default_Switches ("Ada") & + Callgraph_Switch & + Build_Checks_Switches & + ("-g", -- Debug info + "-gnatwa", -- All warnings + "-gnatw_A", -- Turn off warnings for anonymous allocators + "-gnatQ", -- Don't quit. Generate ALI and tree files even if illegalities + "-gnatw.X", -- Disable warnings for No_Exception_Propagation + "-ffunction-sections", -- Create a linker section for each function + "-fdata-sections"); -- Create a linker section for each data + end Compiler; + + + for Languages use ("Ada", "Asm_CPP"); + for Create_Missing_Dirs use "True"; + for Object_Dir use "obj_" & Build; + for Library_Dir use "obj_lib_" & Build; + for Library_Kind use "static"; + for Library_Name use "ada_drivers_library"; + + Linker_Switches := ("-T", Project'Project_dir & "/src/link.ld"); + for Target use "arm-eabi"; + for Runtime ("Ada") use "zfp-cortex-m0"; + + package Device_Configuration is + for CPU_Name use "ARM Cortex-M0"; + for Number_Of_Interrupts use "32"; + for Interrupt ("0") use "adl_irq"; + for Interrupt ("1") use "adl_irq"; + for Interrupt ("2") use "adl_irq"; + for Interrupt ("3") use "adl_irq"; + for Interrupt ("4") use "adl_irq"; + for Interrupt ("5") use "adl_irq"; + for Interrupt ("6") use "adl_irq"; + for Interrupt ("7") use "adl_irq"; + for Interrupt ("8") use "adl_irq"; + for Interrupt ("9") use "adl_irq"; + for Interrupt ("10") use "adl_irq"; + for Interrupt ("11") use "adl_irq"; + for Interrupt ("12") use "adl_irq"; + for Interrupt ("13") use "adl_irq"; + for Interrupt ("14") use "adl_irq"; + for Interrupt ("15") use "adl_irq"; + for Interrupt ("16") use "adl_irq"; + for Interrupt ("17") use "adl_irq"; + for Interrupt ("18") use "adl_irq"; + for Interrupt ("19") use "adl_irq"; + for Interrupt ("20") use "adl_irq"; + for Interrupt ("21") use "adl_irq"; + for Interrupt ("22") use "adl_irq"; + for Interrupt ("23") use "adl_irq"; + for Interrupt ("24") use "adl_irq"; + for Interrupt ("25") use "adl_irq"; + for Interrupt ("26") use "adl_irq"; + for Interrupt ("27") use "adl_irq"; + for Interrupt ("28") use "adl_irq"; + for Interrupt ("29") use "adl_irq"; + for Interrupt ("30") use "adl_irq"; + for Interrupt ("31") use "adl_irq"; + + for Memories use ("flash", "ram"); + + for Mem_Kind ("flash") use "rom"; + for Address ("flash") use "0x00000000"; + for Size ("flash") use "256K"; + + for Mem_Kind ("ram") use "ram"; + for Address ("ram") use "0x20000000"; + for Size ("ram") use "16K"; + + for Boot_Memory use "flash"; + end Device_Configuration; + + Board := "MicroBit"; -- From user input + Architecture := "ARM"; -- From board definition + Vendor := "Nordic"; -- From board definition + Device_Family := "nRF51"; -- From board definition + Device_Name := "nRF51822xxAA"; -- From board definition + CPU_Core := "ARM Cortex-M0"; -- From mcu definition + Number_Of_Interrupts := "32"; -- From MCU definition + Has_ZFP_Runtime := "True"; -- From board definition + Has_Ravenscar_SFP_Runtime := "False"; -- From board definition + Has_Ravenscar_Full_Runtime := "False"; -- From board definition + Runtime_Profile := "zfp"; -- From user input + Runtime_Name_Suffix := "cortex-m0"; -- From board definition + Runtime_Name := "zfp-cortex-m0"; -- From user input + Use_Startup_Gen := "True"; -- From user input + Has_Custom_Memory_Area_1 := "False"; -- From user input + Boot_Memory := "flash"; -- From user input + Max_Path_Length := "1024"; -- From user input + Max_Mount_Points := "2"; -- From user input + Max_Mount_Name_Length := "128"; -- From user input + + -- Project source directories + Src_Dirs_Root := "../.."; + for Source_Dirs use ( + Src_Dirs_Root & "/hal/src/", -- From HAL config + Src_Dirs_Root & "/boards/MicroBit/src/", -- From board definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/cm0", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/nocache", -- From arch definition + Src_Dirs_Root & "/arch/ARM/cortex_m/src/nvic_cm0", -- From arch definition + Src_Dirs_Root & "/arch/ARM/Nordic/devices/nrf51", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/drivers/nrf_common", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/drivers/nrf51", -- From MCU definition + Src_Dirs_Root & "/arch/ARM/Nordic/svd/nrf51/", -- From MCU definition + Src_Dirs_Root & "/middleware/src/filesystem", -- From middleware config + Src_Dirs_Root & "/middleware/src/BLE", -- From middleware config + Src_Dirs_Root & "/middleware/src/utils", -- From middleware config + Src_Dirs_Root & "/middleware/src/audio", -- From middleware config + Src_Dirs_Root & "/middleware/src/monitor", -- From middleware config + Src_Dirs_Root & "/middleware/src/bitmap", -- From middleware config + Src_Dirs_Root & "/middleware/src/command_line", -- From middleware config + Src_Dirs_Root & "/middleware/src/sdmmc", -- From middleware config + Src_Dirs_Root & "/middleware/src/neopixel", -- From middleware config + Src_Dirs_Root & "/components/src/**", -- From components config + "src/"); +end Ada_Drivers_Library; diff --git a/scripts/Ada_Drivers_Library/src/adl_config.ads b/scripts/Ada_Drivers_Library/src/adl_config.ads new file mode 100644 index 000000000..0e8855d5a --- /dev/null +++ b/scripts/Ada_Drivers_Library/src/adl_config.ads @@ -0,0 +1,22 @@ +-- This package was generated by the Ada_Drivers_Library project wizard script +package ADL_Config is + Board : constant String := "MicroBit"; -- From user input + Architecture : constant String := "ARM"; -- From board definition + Vendor : constant String := "Nordic"; -- From board definition + Device_Family : constant String := "nRF51"; -- From board definition + Device_Name : constant String := "nRF51822xxAA"; -- From board definition + CPU_Core : constant String := "ARM Cortex-M0"; -- From mcu definition + Number_Of_Interrupts : constant := 32; -- From MCU definition + Has_ZFP_Runtime : constant String := "True"; -- From board definition + Has_Ravenscar_SFP_Runtime : constant String := "False"; -- From board definition + Has_Ravenscar_Full_Runtime : constant String := "False"; -- From board definition + Runtime_Profile : constant String := "zfp"; -- From user input + Runtime_Name_Suffix : constant String := "cortex-m0"; -- From board definition + Runtime_Name : constant String := "zfp-cortex-m0"; -- From user input + Use_Startup_Gen : constant Boolean := True; -- From user input + Has_Custom_Memory_Area_1 : constant Boolean := False; -- From user input + Boot_Memory : constant String := "flash"; -- From user input + Max_Path_Length : constant := 1024; -- From user input + Max_Mount_Points : constant := 2; -- From user input + Max_Mount_Name_Length : constant := 128; -- From user input +end ADL_Config; diff --git a/scripts/build_all_examples.py b/scripts/build_all_examples.py index 415ee3e7c..11a496664 100755 --- a/scripts/build_all_examples.py +++ b/scripts/build_all_examples.py @@ -133,6 +133,9 @@ def gprbuild(project_file, debug=False): "/examples/MicroBit/follower/follower.gpr", "/examples/MicroBit/accelerometer/accelerometer.gpr", + # MicroBit v2 + "/examples/MicroBit_v2/text_scrolling/text_scrolling.gpr", + # NRF52_SDK "/boards/NRF52_DK/nrf52_dk_zfp.gpr", "/examples/NRF52_DK/buttons/buttons.gpr", diff --git a/scripts/config/__init__.py b/scripts/config/__init__.py index 6096832a3..08ddcc06c 100644 --- a/scripts/config/__init__.py +++ b/scripts/config/__init__.py @@ -39,7 +39,7 @@ def get_config(self, key): def ada_configuration(self): out = "" - for key in self.configuration: + for key in sorted(self.configuration): origin = self.configuration[key]['origin'] value = self.configuration[key]['value'] kind = self.configuration[key]['kind'] @@ -99,7 +99,7 @@ def gpr_configuration(self, src_root_dir, extra_source_dir): out += ' end Device_Configuration;\n\n' # Config keys and values - for key in self.configuration: + for key in sorted(self.configuration): origin = self.configuration[key]['origin'] value = self.configuration[key]['value'] out += " %-30s := %-20s -- From %s\n" % \ diff --git a/scripts/config/boards.py b/scripts/config/boards.py index c4ab35885..af547d78b 100644 --- a/scripts/config/boards.py +++ b/scripts/config/boards.py @@ -14,6 +14,7 @@ def list_of_boards(): 'Feather_STM32F405', 'OpenMV2', "MicroBit", + "MicroBit_v2", "NRF52_DK", "HiFive1", "HiFive1_rev_B", @@ -172,6 +173,17 @@ def load_board_config(config): config.pre_define('Runtime_Name_Suffix', 'cortex-m0', origin) config.add_source_dir('boards/MicroBit/src/', origin) + elif board == "MicroBit_v2": + config.pre_define('Architecture', 'ARM', origin) + config.pre_define('Vendor', 'Nordic', origin) + config.pre_define('Device_Family', 'nRF52', origin) + config.pre_define('Device_Name', 'nRF52833xxAA', origin) + config.pre_define('Has_ZFP_Runtime', 'True', origin) + config.pre_define('Has_Ravenscar_SFP_Runtime', 'False', origin) + config.pre_define('Has_Ravenscar_Full_Runtime', 'False', origin) + config.pre_define('Runtime_Name_Suffix', 'cortex-m4f', origin) + config.add_source_dir('boards/MicroBit_v2/src/', origin) + elif board == "NRF52_DK": config.pre_define('Architecture', 'ARM', origin) config.pre_define('Vendor', 'Nordic', origin) diff --git a/scripts/config/devices.py b/scripts/config/devices.py index 71e0325ed..6bc015f8c 100644 --- a/scripts/config/devices.py +++ b/scripts/config/devices.py @@ -34,7 +34,7 @@ def list_of_devices(config): elif family == "nRF51": return ['nRF51822xxAA'] elif family == "nRF52": - return ['nRF52832xxAA'] + return ['nRF52832xxAA', 'nRF52833xxAA'] elif family == "FE3": return ['FE310'] elif family == "U5": @@ -196,8 +196,16 @@ def load_device_config(config, source_dir): config.pre_define('Number_Of_Interrupts', 128, origin) - config.add_memory('rom', 'flash', '0x00000000', '512K') - config.add_memory('ram', 'ram', '0x20000000', '64K') + if mcu.startswith('nRF52832'): + if mcu.endswith ('AA'): + config.add_memory('rom', 'flash', '0x00000000', '512K') + config.add_memory('ram', 'ram', '0x20000000', '64K') + elif mcu.endswith ('AB'): + config.add_memory('rom', 'flash', '0x00000000', '256K') + config.add_memory('ram', 'ram', '0x20000000', '32K') + elif mcu.startswith('nRF52833'): + config.add_memory('rom', 'flash', '0x00000000', '512K') + config.add_memory('ram', 'ram', '0x20000000', '128K') elif mcu == 'FE310': src += ['arch/RISC-V/SiFive/svd/FE310/',