You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/02 14:57:00 UTC

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2138: Add possibility to configure idle task stack size in syscfg.yml

apache-mynewt-bot removed a comment on issue #2138: Add possibility to configure idle task stack size in syscfg.yml
URL: https://github.com/apache/mynewt-core/pull/2138#issuecomment-585166638
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### hw/mcu/stm/stm32l1xx/src/hal_power_mgnt.c
   <details>
   
   ```diff
   @@ -32,22 +32,25 @@
    extern void hal_rtc_init(RTC_DateTypeDef *date, RTC_TimeTypeDef *time);
    
    /* Put MCU  in lowest power stop state, exit only via POR or reset pin */
   -void hal_mcu_halt()
   +void
   +hal_mcu_halt()
    {
        /* all interupts and exceptions off */
        /* PVD off */
        /* power watchdog off */
        /* Be in lowest power mode forever */
   -    while (1)
   -    {
   -        //        HAL_PWR_EnterSTANDBYMode();
   -        // TEST : don't lose RAM so can debug low powerness
   +    while (1) {
   +        /*
   +                  HAL_PWR_EnterSTANDBYMode();
   +           TEST : don't lose RAM so can debug low powerness
   +         */
            HAL_PWR_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFI);
            /* debug breakpoint */
        }
    }
    
   -void stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
   +void
   +stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
    {
        /* Even for tickless we use SYSTICK for normal tick.*/
        /*nb of ticks per seconds is hardcoded in HAL_InitTick(..) to have 1ms/tick */
   @@ -79,23 +82,25 @@
        hal_rtc_init(NULL, NULL);
    #endif
    }
   -void stm32_tickless_start(uint32_t timeMS)
   +void
   +stm32_tickless_start(uint32_t timeMS)
    {
        /* Start RTC alarm for in this amount of time */
        hal_rtc_enable_wakeup(timeMS);
        /* Stop SYSTICK */
        NVIC_DisableIRQ(SysTick_IRQn);
   -    //HAL_SuspendTick();
   +    /*HAL_SuspendTick(); */
    }
    
   -void stm32_tickless_stop(uint32_t timeMS)
   +void
   +stm32_tickless_stop(uint32_t timeMS)
    {
        /* disable RTC */
        hal_rtc_disable_wakeup();
    
        /* reenable systick */
        NVIC_EnableIRQ(SysTick_IRQn);
   -    //HAL_ResumeTick();
   +    /*HAL_ResumeTick(); */
    
        /* add asleep duration to tick counter : how long we should have slept for minus any remaining time */
        int asleep_ticks = os_time_ms_to_ticks32(timeMS - hal_rtc_get_remaining_time_before_wakeup());
   @@ -103,11 +108,11 @@
        os_time_advance(asleep_ticks);
    }
    
   -void stm32_power_enter(int power_mode, uint32_t durationMS)
   +void
   +stm32_power_enter(int power_mode, uint32_t durationMS)
    {
        /* if sleep time was less than MIN_TICKS, it is 0. Just do usual WFI and systick will wake us in 1ms */
   -    if (durationMS == 0)
   -    {
   +    if (durationMS == 0) {
            HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
            return;
        }
   @@ -116,8 +121,7 @@
        stm32_tickless_start(durationMS);
    #endif
    
   -    switch (power_mode)
   -    {
   +    switch (power_mode) {
        case HAL_BSP_POWER_OFF:
        {
            HAL_PWR_EnterSTANDBYMode();
   ```
   
   </details>
   
   #### hw/mcu/stm/stm32l1xx/src/rtc_utils.c
   <details>
   
   ```diff
   @@ -1,15 +1,15 @@
    /**
     * Copyright 2019 Wyres
   - * Licensed under the Apache License, Version 2.0 (the "License"); 
   - * you may not use this file except in compliance with the License. 
   + * Licensed under the Apache License, Version 2.0 (the "License");
   + * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *    http://www.apache.org/licenses/LICENSE-2.0
   - * Unless required by applicable law or agreed to in writing, 
   - * software distributed under the License is distributed on 
   - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
   - * either express or implied. See the License for the specific 
   + * Unless required by applicable law or agreed to in writing,
   + * software distributed under the License is distributed on
   + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
   + * either express or implied. See the License for the specific
     * language governing permissions and limitations under the License.
   -*/
   + */
    
    /**
     * Hal for rtc management
   @@ -23,19 +23,19 @@
    #include "stm32l1xx_hal_pwr.h"
    #include "bsp.h"
    
   -// sub-second number of bits
   +/* sub-second number of bits */
    #define N_PREDIV_S 10
    
   -// Synchronous prediv
   +/* Synchronous prediv */
    #define PREDIV_S ((1 << N_PREDIV_S) - 1)
    
   -// Asynchronous prediv
   +/* Asynchronous prediv */
    #define PREDIV_A (1 << (15 - N_PREDIV_S)) - 1
    
   -// Sub-second mask definition
   +/* Sub-second mask definition */
    #define ALARM_SUBSECOND_MASK (N_PREDIV_S << RTC_ALRMASSR_MASKSS_Pos)
    
   -// RTC Time base in us
   +/* RTC Time base in us */
    #define USEC_NUMBER 1000000
    #define MSEC_NUMBER (USEC_NUMBER / 1000)
    
   @@ -74,48 +74,49 @@
    #define MAX_RTC_PERIOD_MSEC (1000.0f * MAX_RTC_PERIOD_SEC)
    
    /*!
   - * RTC timer context 
   - */
   -typedef struct
   -{
   -    uint32_t Time;                // Reference time
   -    RTC_TimeTypeDef CalendarTime; // Reference time in calendar format
   -    RTC_DateTypeDef CalendarDate; // Reference date in calendar format
   + * RTC timer context
   + */
   +typedef struct {
   +    uint32_t Time;                /* Reference time */
   +    RTC_TimeTypeDef CalendarTime; /* Reference time in calendar format */
   +    RTC_DateTypeDef CalendarDate; /* Reference date in calendar format */
    } RtcTimerContext_t;
    
    /*!
     * \brief RTC Handle
     */
   -static RTC_HandleTypeDef RtcHandle =
   -    {
   -        .Instance = NULL,
   -        .Init =
   -            {
   -                .HourFormat = 0,
   -                .AsynchPrediv = 0,
   -                .SynchPrediv = 0,
   -                .OutPut = 0,
   -                .OutPutPolarity = 0,
   -                .OutPutType = 0},
   -        .Lock = HAL_UNLOCKED,
   -        .State = HAL_RTC_STATE_RESET};
   -
   -/**
   -  * @brief  This function handles  WAKE UP TIMER  interrupt request.
   -  * @retval None
   -  */
   -void RTC_WKUP_IRQHandler(void)
   +static RTC_HandleTypeDef RtcHandle = {
   +    .Instance = NULL,
   +    .Init = {
   +        .HourFormat = 0,
   +        .AsynchPrediv = 0,
   +        .SynchPrediv = 0,
   +        .OutPut = 0,
   +        .OutPutPolarity = 0,
   +        .OutPutType = 0
   +    },
   +    .Lock = HAL_UNLOCKED,
   +    .State = HAL_RTC_STATE_RESET
   +};
   +
   +/**
   + * @brief  This function handles  WAKE UP TIMER  interrupt request.
   + * @retval None
   + */
   +void
   +RTC_WKUP_IRQHandler(void)
    {
        HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle);
    }
    
    /**
   -  * @brief  Wake Up Timer callback.
   -  * @param  hrtc: pointer to a RTC_HandleTypeDef structure that contains
   -  *                the configuration information for RTC.
   -  * @retval None
   -  */
   -void HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
   + * @brief  Wake Up Timer callback.
   + * @param  hrtc: pointer to a RTC_HandleTypeDef structure that contains
   + *                the configuration information for RTC.
   + * @retval None
   + */
   +void
   +HAL_RTCEx_WakeUpTimerEventCallback(RTC_HandleTypeDef *hrtc)
    {
    }
    
   @@ -124,25 +125,28 @@
    #endif
    
    /**
   -  * @brief  This function handles  ALARM (A&B)  interrupt request.
   -  * @retval None
   -  */
   -void RTC_Alarm_IRQHandler(void)
   + * @brief  This function handles  ALARM (A&B)  interrupt request.
   + * @retval None
   + */
   +void
   +RTC_Alarm_IRQHandler(void)
    {
        HAL_RTC_AlarmIRQHandler(&RtcHandle);
    }
    
    /**
   -  * @brief  Alarm A callback.
   -  * @param  hrtc: pointer to a RTC_HandleTypeDef structure that contains
   -  *                the configuration information for RTC.
   -  * @retval None
   -  */
   -void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
   -{
   -}
   -
   -void hal_rtc_init(RTC_DateTypeDef *date, RTC_TimeTypeDef *time)
   + * @brief  Alarm A callback.
   + * @param  hrtc: pointer to a RTC_HandleTypeDef structure that contains
   + *                the configuration information for RTC.
   + * @retval None
   + */
   +void
   +HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
   +{
   +}
   +
   +void
   +hal_rtc_init(RTC_DateTypeDef *date, RTC_TimeTypeDef *time)
    {
        int rc;
    
   @@ -151,8 +155,8 @@
    
        RtcHandle.Instance = RTC;
        RtcHandle.Init.HourFormat = RTC_HOURFORMAT_24;
   -    RtcHandle.Init.AsynchPrediv = PREDIV_A; // RTC_ASYNCH_PREDIV;
   -    RtcHandle.Init.SynchPrediv = PREDIV_S;  // RTC_SYNCH_PREDIV;
   +    RtcHandle.Init.AsynchPrediv = PREDIV_A; /* RTC_ASYNCH_PREDIV; */
   +    RtcHandle.Init.SynchPrediv = PREDIV_S;  /* RTC_SYNCH_PREDIV; */
        RtcHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
        RtcHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
        RtcHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
   @@ -160,33 +164,29 @@
    
        assert(rc == 0);
    
   -    if (date == NULL)
   -    {
   -
   -        RTC_DateTypeDef default_date =
   -            {
   -                .Year = 0,
   -                .Month = RTC_MONTH_JANUARY,
   -                .Date = 1,
   -                .WeekDay = RTC_WEEKDAY_MONDAY,
   -            };
   +    if (date == NULL) {
   +
   +        RTC_DateTypeDef default_date = {
   +            .Year = 0,
   +            .Month = RTC_MONTH_JANUARY,
   +            .Date = 1,
   +            .WeekDay = RTC_WEEKDAY_MONDAY,
   +        };
    
            date = &default_date;
        }
    
   -    if (time != NULL)
   -    {
   -
   -        RTC_TimeTypeDef default_time =
   -            {
   -                .Hours = 0,
   -                .Minutes = 0,
   -                .Seconds = 0,
   -                .SubSeconds = 0,
   -                .TimeFormat = 0,
   -                .StoreOperation = RTC_STOREOPERATION_RESET,
   -                .DayLightSaving = RTC_DAYLIGHTSAVING_NONE,
   -            };
   +    if (time != NULL) {
   +
   +        RTC_TimeTypeDef default_time = {
   +            .Hours = 0,
   +            .Minutes = 0,
   +            .Seconds = 0,
   +            .SubSeconds = 0,
   +            .TimeFormat = 0,
   +            .StoreOperation = RTC_STOREOPERATION_RESET,
   +            .DayLightSaving = RTC_DAYLIGHTSAVING_NONE,
   +        };
    
            time = &default_time;
        }
   @@ -194,11 +194,13 @@
        HAL_RTC_SetDate(&RtcHandle, date, RTC_FORMAT_BIN);
        HAL_RTC_SetTime(&RtcHandle, time, RTC_FORMAT_BIN);
    
   -    // Enable Direct Read of the calendar registers (not through Shadow registers)
   -    //HAL_RTCEx_EnableBypassShadow( &RtcHandle );
   +    /*
   +       Enable Direct Read of the calendar registers (not through Shadow registers)
   +       HAL_RTCEx_EnableBypassShadow( &RtcHandle );
   +     */
    
    #ifdef RTC_ALARM_TEST
   -    //setup alarm
   +    /*setup alarm */
        RtcAlarm.AlarmTime.Hours = 0;
        RtcAlarm.AlarmTime.Minutes = 0;
        RtcAlarm.AlarmTime.Seconds = 1;
   @@ -229,98 +231,95 @@
    static uint32_t clk_srce_sel;
    static uint16_t wkup_autoreload_timer;
    
   -void hal_rtc_enable_wakeup(uint32_t time_ms)
   +void
   +hal_rtc_enable_wakeup(uint32_t time_ms)
    {
        /* Enable and set RTC_WKUP_IRQ */
    
   -    //this NVIC setup doesn't work ....
   -    //TODO : find out why ...
   -    //HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 6, 0);
   -    //HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
   -    //HAL_NVIC_DisableIRQ(RTC_WKUP_IRQn);
   +    /*
   +       this NVIC setup doesn't work ....
   +       TODO : find out why ...
   +       HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 6, 0);
   +       HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
   +       HAL_NVIC_DisableIRQ(RTC_WKUP_IRQn);
   +     */
    
        NVIC_DisableIRQ(RTC_WKUP_IRQn);
    
        __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
    
        /*
   -    The wakeup timer clock input can be:
   -    • RTC clock (RTCCLK) divided by 2, 4, 8, or 16.
   -    When RTCCLK is LSE(32.768kHz), this allows configuring the wakeup interrupt period
   -    from 122 µs to 32 s, with a resolution down to 61µs
   -    • ck_spre (usually 1 Hz internal clock)
   -    When ck_spre frequency is 1Hz, this allows achieving a wakeup time from 1 s to
   -    around 36 hours with one-second resolution. This large programmable time range is
   -    divided in 2 parts:
   -    – from 1s to 18 hours when WUCKSEL [2:1] = 10
   -    – and from around 18h to 36h when WUCKSEL[2:1] = 11
   -    */
   -
   -    if (time_ms < (uint32_t)(MAX_RTC_PERIOD_MSEC))
   -    {
   +       The wakeup timer clock input can be:
   +       • RTC clock (RTCCLK) divided by 2, 4, 8, or 16.
   +       When RTCCLK is LSE(32.768kHz), this allows configuring the wakeup interrupt period
   +       from 122 µs to 32 s, with a resolution down to 61µs
   +       • ck_spre (usually 1 Hz internal clock)
   +       When ck_spre frequency is 1Hz, this allows achieving a wakeup time from 1 s to
   +       around 36 hours with one-second resolution. This large programmable time range is
   +       divided in 2 parts:
   +       – from 1s to 18 hours when WUCKSEL [2:1] = 10
   +       – and from around 18h to 36h when WUCKSEL[2:1] = 11
   +     */
   +
   +    if (time_ms < (uint32_t)(MAX_RTC_PERIOD_MSEC)) {
            clk_srce_sel = RTC_WAKEUPCLOCK_RTCCLK_DIV16;
            wkup_autoreload_timer = (uint32_t)((float)time_ms / (MIN_RTC_PERIOD_MSEC));
   -    }
   -    else if (time_ms < (uint32_t)(18 * 60 * 60 * 1000))
   -    {
   +    } else if (time_ms < (uint32_t)(18 * 60 * 60 * 1000))   {
            clk_srce_sel = RTC_WAKEUPCLOCK_CK_SPRE_16BITS;
            wkup_autoreload_timer = (time_ms / 1000);
   -    }
   -    else if (time_ms < (uint32_t)(MYNEWT_VAL(OS_IDLE_TICKLESS_MS_MAX)))
   -    {
   +    } else if (time_ms < (uint32_t)(MYNEWT_VAL(OS_IDLE_TICKLESS_MS_MAX)))   {
            clk_srce_sel = RTC_WAKEUPCLOCK_CK_SPRE_17BITS;
            wkup_autoreload_timer = (time_ms / 1000);
   -    }
   -    else
   -    {
   +    } else   {
            /*
   -        TODO : setup wakeup with ALARM feature istead of wakeup     
   -        */
   +           TODO : setup wakeup with ALARM feature istead of wakeup
   +         */
            clk_srce_sel = RTC_WAKEUPCLOCK_CK_SPRE_17BITS;
   -        /* 
   -       for now, set the maximum possible time
   -       */
   +        /*
   +           for now, set the maximum possible time
   +         */
            wkup_autoreload_timer = 0xFFFF;
        }
    
        HAL_RTCEx_SetWakeUpTimer_IT(&RtcHandle, (uint32_t)wkup_autoreload_timer, clk_srce_sel);
    
   -    //NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_WKUP_IRQHandler);
   -    //NVIC_SetPriority(RTC_WKUP_IRQn, 10);
   -    //NVIC_EnableIRQ(RTC_WKUP_IRQn);
   -}
   -
   -uint32_t hal_rtc_get_remaining_time_before_wakeup(void)
   +    /*
   +       NVIC_SetVector(RTC_WKUP_IRQn, (uint32_t)RTC_WKUP_IRQHandler);
   +       NVIC_SetPriority(RTC_WKUP_IRQn, 10);
   +       NVIC_EnableIRQ(RTC_WKUP_IRQn);
   +     */
   +}
   +
   +uint32_t
   +hal_rtc_get_remaining_time_before_wakeup(void)
    {
        uint32_t time_ms, elapsed_time = HAL_RTCEx_GetWakeUpTimer(&RtcHandle);
    
   -    if (clk_srce_sel == RTC_WAKEUPCLOCK_RTCCLK_DIV16)
   -    {
   +    if (clk_srce_sel == RTC_WAKEUPCLOCK_RTCCLK_DIV16) {
            time_ms = (uint32_t)(((float)elapsed_time) * (MIN_RTC_PERIOD_MSEC));
   -    }
   -    else //if(clk_srce_sel == RTC_WAKEUPCLOCK_CK_SPRE_16BITS )
   -    {
   +    } else   { /*if(clk_srce_sel == RTC_WAKEUPCLOCK_CK_SPRE_16BITS ) */
            time_ms = (elapsed_time * 1000);
        }
        /*
   -    else if(clk_srce_sel == RTC_WAKEUPCLOCK_CK_SPRE_17BITS )
   -    {   
   +       else if(clk_srce_sel == RTC_WAKEUPCLOCK_CK_SPRE_17BITS )
   +       {
            time_ms = (elapsed_time * 1000);
   -    }
   -    */
   -    /*
   -        TODO : setup wakeup with ALARM feature istead of wakeup     
   -       
   -    else{
   +       }
   +     */
   +    /*
   +        TODO : setup wakeup with ALARM feature istead of wakeup
   +
   +       else{
            time_ms = (elapsed_time * 1000) + (36 * 60 * 60 * 1000);
    
   -    }
   -    */
   +       }
   +     */
    
        return time_ms;
    }
    
   -void hal_rtc_disable_wakeup(void)
   +void
   +hal_rtc_disable_wakeup(void)
    {
        HAL_RTCEx_DeactivateWakeUpTimer(&RtcHandle);
        NVIC_DisableIRQ(RTC_WKUP_IRQn);
   ```
   
   </details>
   
   #### hw/mcu/stm/stm32_common/src/hal_os_tick.c
   <details>
   
   ```diff
   @@ -39,10 +39,11 @@
    #if defined(STM32F405xx) || defined(STM32F407xx) || \
        defined(STM32F415xx) || defined(STM32F417xx)
    #undef __WFI
   -__attribute__((aligned(8), naked)) void static __WFI(void)
   +__attribute__((aligned(8), naked)) void static
   +__WFI(void)
    {
   -    __ASM volatile("wfi\n"
   -                   "bx lr");
   +    __ASM volatile ("wfi\n"
   +                    "bx lr");
    }
    #endif
    
   @@ -51,7 +52,8 @@
    extern void stm32_power_enter(int power_mode, uint32_t durationMS);
    extern void stm32_tick_init(uint32_t os_ticks_per_sec, int prio);
    #else
   -static void stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
   +static void
   +stm32_tick_init(uint32_t os_ticks_per_sec, int prio)
    {
        /*nb of ticks per seconds is hardcoded in HAL_InitTick(..) to have 1ms/tick */
        assert(os_ticks_per_sec == OS_TICKS_PER_SEC);
   @@ -77,18 +79,21 @@
        DBGMCU->CR |= (DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
    #endif
    }
   -static void stm32_power_enter(int power_mode, uint32_t durationMS)
   +static void
   +stm32_power_enter(int power_mode, uint32_t durationMS)
    {
        __DSB();
        __WFI();
    }
   -void stm32_tickless_init()
   +void
   +stm32_tickless_init()
    {
    }
    
    #endif
    
   -void os_tick_idle(os_time_t ticks)
   +void
   +os_tick_idle(os_time_t ticks)
    {
        /* default mode will enter in WFI */
        int power_mode = HAL_BSP_POWER_WFI;
   @@ -96,8 +101,7 @@
        OS_ASSERT_CRITICAL();
    
        /* if < MIN_TICKS, then just leave standard SYSTICK and WFI to and wakeup in 1ms */
   -    if (ticks == 0)
   -    {
   +    if (ticks == 0) {
            __DSB();
            __WFI();
            return;
   @@ -124,7 +128,8 @@
    #endif
    }
    
   -void os_tick_init(uint32_t os_ticks_per_sec, int prio)
   +void
   +os_tick_init(uint32_t os_ticks_per_sec, int prio)
    {
        stm32_tick_init(os_ticks_per_sec, prio);
    }
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services