diff --git a/microbit/adainclude/FreeRTOSConfig.h b/microbit/adainclude/FreeRTOSConfig.h index 526fe49..76d6966 100644 --- a/microbit/adainclude/FreeRTOSConfig.h +++ b/microbit/adainclude/FreeRTOSConfig.h @@ -31,15 +31,15 @@ #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configCPU_CLOCK_HZ ( 16000000 ) -#define configTICK_RATE_HZ ( ( portTickType ) 1024 ) +#define configTICK_RATE_HZ ( ( TickType_t ) 1024 ) /* Extend the number of priority levels to cope with Ada ceiling priorities, which mean we need to raise a task waiting for an ISR to a priority corresponding to that interrupt's priority. So we - need the additional priorities 8 (interrupt priority 3) to 9 - (interrupt priority 2, the highest that can use API interrupt-safe + need the additional priorities 8 (interrupt priority 3) to 10 + (interrupt priority 1, the highest that can use API interrupt-safe functions). */ -#define configMAX_PRIORITIES ( 9 ) +#define configMAX_PRIORITIES ( 10 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16 * 1024 ) ) @@ -55,6 +55,7 @@ #define configUSE_APPLICATION_TASK_TAG 1 /* for Task_Id in TCB */ #define configUSE_COUNTING_SEMAPHORES 0 #define configGENERATE_RUN_TIME_STATS 0 +#define configUSE_QUEUE_SETS 0 #define configUSE_TIME_SLICING 0 /* don't want round-robin */ @@ -105,6 +106,7 @@ function. */ routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values. */ +/* UNCLEAR THAT THIS IS TRUE FOR A CM0 PART, WHICH DOESN'T HAVE BASEPRI */ #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1 /* Interrupt priorities used by the kernel port layer itself. These are generic @@ -122,7 +124,6 @@ header file. */ standard names. */ #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler - #define xPortSysTickHandler SysTick_Handler #endif /* FREERTOS_CONFIG_H */ diff --git a/microbit/adainclude/nrf51_clock.adb b/microbit/adainclude/nrf51_clock.adb index f533ef3..bc1173f 100644 --- a/microbit/adainclude/nrf51_clock.adb +++ b/microbit/adainclude/nrf51_clock.adb @@ -31,9 +31,10 @@ -- below: -- -- priority 0 (highest): FreeRTOS use only --- priority 1: RTC1_IRQHandler --- priority 2 .. 3: applications, arranged in this RTS as (interrupt) --- priorities 9, 8 respectively. +-- priority 1 .. 3: applications, arranged in this RTS as (interrupt) +-- priorities 10, 9, 8 respectively. + +-- RTC1_IRQHandler runs at ARM priority 3, Interrupt_Priority'First. with nrf51.CLOCK; with nrf51.RTC; @@ -128,7 +129,7 @@ package body nRF51_Clock is Address => System'To_Address (16#E000E100#); Interrupt : constant := 17; - Prio : constant := System.Priority'Last + 1; + Prio : constant := System.Interrupt_Priority'First; begin declare Index : constant Natural := Interrupt / 4; diff --git a/microbit/adainclude/system.ads b/microbit/adainclude/system.ads index 7aa02f5..fadf2b4 100644 --- a/microbit/adainclude/system.ads +++ b/microbit/adainclude/system.ads @@ -8,7 +8,8 @@ -- (ARM Cortex M Version) -- -- (Derived from GNU-Linux/ARMEL Version) -- -- -- --- Copyright (C) 1992-2010, 2016-2018, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2010, 2016-2018, 2020 -- +-- Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -74,7 +75,7 @@ package System is Max_Mantissa : constant := 63; Fine_Delta : constant := 2.0 ** (-Max_Mantissa); - Tick : constant := 0.01; + Tick : constant := 1.0 / 1024; -- Storage-related Declarations @@ -110,12 +111,12 @@ package System is -- These declarations correspond to FreeRTOS as originally -- configured in STM Cube (thread priorities 0 .. 7), with - -- priorities 8 to 9 mapped to Cortex interrupt priorities 3 - -- (lowest) to 2 (highest that can be used by ISRs that call + -- priorities 8 to 10 mapped to Cortex interrupt priorities 3 + -- (lowest) to 1 (highest that can be used by ISRs that call -- interrupt-safe FreeRTOS API functions). Max_Priority : constant Positive := 7; - Max_Interrupt_Priority : constant Positive := 9; + Max_Interrupt_Priority : constant Positive := 10; subtype Any_Priority is Integer range 0 .. Max_Interrupt_Priority; subtype Priority is Any_Priority