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/01/07 13:46:24 UTC

[GitHub] [mynewt-core] utzig commented on a change in pull request #2138: Add possibility to configure idle task stack size in syscfg.yml

utzig commented on a change in pull request #2138: Add possibility to configure idle task stack size in syscfg.yml
URL: https://github.com/apache/mynewt-core/pull/2138#discussion_r363753755
 
 

 ##########
 File path: hw/mcu/stm/stm32_common/src/hal_os_tick.c
 ##########
 @@ -1,78 +1,135 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 language governing permissions and limitations
- * under the License.
- */
-
-#include <assert.h>
-#include "os/mynewt.h"
-#include <hal/hal_os_tick.h>
-
-/*
- * XXX implement tickless mode.
- */
-
-/*
- * Errata for STM32F405, STM32F407, STM32F415, STM32F417.
- * When WFI instruction is placed at address like 0x080xxxx4
- * (also seen for addresses ending with xxx2). System may
- * crash.
- * __WFI function places WFI instruction at address ending with x0 or x8
- * for affected MCUs.
- */
-#if defined(STM32F405xx) || defined(STM32F407xx) || \
-    defined(STM32F415xx) || defined(STM32F417xx)
-#undef __WFI
-__attribute__((aligned(8), naked)) void static
-__WFI(void)
-{
-     __ASM volatile("wfi\n"
-                    "bx lr");
-}
-#endif
-
-void
-os_tick_idle(os_time_t ticks)
-{
-    OS_ASSERT_CRITICAL();
-    __DSB();
-    __WFI();
-}
-
-void
-os_tick_init(uint32_t os_ticks_per_sec, int prio)
-{
-    uint32_t reload_val;
-
-    reload_val = ((uint64_t)SystemCoreClock / os_ticks_per_sec) - 1;
-
-    /* Set the system time ticker up */
-    SysTick->LOAD = reload_val;
-    SysTick->VAL = 0;
-    SysTick->CTRL = 0x0007;
-
-    /* Set the system tick priority */
-    NVIC_SetPriority(SysTick_IRQn, prio);
-
-    /*
-     * Keep clocking debug even when CPU is sleeping, stopped or in standby.
-     */
-#if !MYNEWT_VAL(MCU_STM32F0)
-    DBGMCU->CR |= (DBGMCU_CR_DBG_SLEEP | DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
-#else
-    DBGMCU->CR |= (DBGMCU_CR_DBG_STOP | DBGMCU_CR_DBG_STANDBY);
-#endif
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include "os/mynewt.h"
+#include <hal/hal_os_tick.h>
+#include <hal/hal_bsp.h>
+#include "bsp/bsp.h"
+#include "system_stm32l1xx.h"
 
 Review comment:
   This file is shared by all STM32 ports so adding STM32L1x specific includes here is not OK. Also please fix your file save format because it is probably using `\r\n` for line endings (based on the diff).

----------------------------------------------------------------
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