打印
[Atmel]

发现mbed rtos 在Atmel这块有BUG

[复制链接]
961|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
昨天我试了了,mbed 的rtos,程序如下:


#include "mbed.h"
#include "rtos.h"

DigitalOut led1(LED1);


void led1_thread(void const *args) {
    while (true) {
        led1 = !led1;
        Thread::wait(1000);
    }
}

int main() {
    Thread thread(led1_thread);
   
    while (true) {
           Thread::wait(500);
    }
}
}
刚开始是没有加rtos库提示如下:


在子目录mbed-dev点右键,导入库
再编译确出现如下:




看了下,rtos根本就没有Atmel的型号如下:


/*----------------------------------------------------------------------------
*      RTX User configuration part BEGIN
*---------------------------------------------------------------------------*/

//-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
//
// <h>Thread Configuration
// =======================
//
//   <o>Number of concurrent running threads <0-250>
//   <i> Defines max. number of threads that will run at the same time.
//       counting "main", but not counting "osTimerThread"
//   <i> Default: 6
#ifndef OS_TASKCNT
#  if   defined(TARGET_LPC1768) || defined(TARGET_LPC2368)   || defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_LPC4330) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347) || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\
   || defined(TARGET_STM32F410RB) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z)  || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \
   || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI) || defined(TARGET_STM32F401VC) || defined(TARGET_MAX32610) || defined(TARGET_MAX32600) || defined(TARGET_TEENSY3_1) \
   || defined(TARGET_STM32L152RE) || defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE) || defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG) || defined(TARGET_STM32F469NI) || defined(TARGET_STM32F746NG) || defined(TARGET_STM32L152RC)
#    define OS_TASKCNT         14
#  elif defined(TARGET_LPC11U24) || defined(TARGET_STM32F303RE) || defined(TARGET_STM32F303K8) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO) || defined(TARGET_LPC1114) \
   || defined(TARGET_LPC812)   || defined(TARGET_KL25Z)         || defined(TARGET_KL26Z)         || defined(TARGET_KL05Z)        || defined(TARGET_STM32F100RB)  || defined(TARGET_STM32F051R8) \
   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) \
   || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC) || defined(TARGET_NZ32_SC151) \
   || defined(TARGET_SSCI824)  || defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB)
#    define OS_TASKCNT         6
#  else
#    error "no target defined"
#  endif
#endif

//   <o>Scheduler (+ interrupts) stack size [bytes] <64-4096:8><#/4>
#ifndef OS_SCHEDULERSTKSIZE
#  if   defined(TARGET_LPC1768) || defined(TARGET_LPC2368)   || defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_LPC4330) || defined(TARGET_LPC4337) || defined(TARGET_LPC1347)  || defined(TARGET_K64F) || defined(TARGET_STM32F401RE)\
   || defined(TARGET_STM32F410RB) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F407) || defined(TARGET_F407VG)  || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_LPC11U68) \
   || defined(TARGET_STM32F411RE) || defined(TARGET_STM32F405RG) || defined(TARGET_K22F) || defined(TARGET_STM32F429ZI) || defined(TARGET_STM32F401VC) || defined(TARGET_MAX32610) || defined(TARGET_MAX32600) || defined(TARGET_TEENSY3_1) \
   || defined(TARGET_STM32L152RE) || defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE) || defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG) || defined(TARGET_STM32F469NI) || defined(TARGET_STM32F746NG) || defined(TARGET_STM32L152RC)
#      define OS_SCHEDULERSTKSIZE    256
#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)  || defined(TARGET_LPC1114) \
   || defined(TARGET_LPC812)   || defined(TARGET_KL25Z)         || defined(TARGET_KL26Z)        || defined(TARGET_KL05Z)        || defined(TARGET_STM32F100RB)  || defined(TARGET_STM32F051R8) \
   || defined(TARGET_STM32F103RB) || defined(TARGET_LPC824) || defined(TARGET_STM32F302R8) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC) || defined(TARGET_NZ32_SC151) \
   || defined(TARGET_SSCI824) || defined(TARGET_STM32F030R8) || defined(TARGET_STM32F070RB)
#      define OS_SCHEDULERSTKSIZE    128
#  elif defined(TARGET_STM32F334R8) || defined(TARGET_STM32F303RE) ||  defined(TARGET_STM32F303K8) ||  defined(TARGET_STM32F334C8) || defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
#      define OS_SCHEDULERSTKSIZE    112
#  else
#    error "no target defined"
#  endif
#endif

//   <o>Idle stack size [bytes] <64-4096:8><#/4>
//   <i> Defines default stack size for the Idle thread.
#ifndef OS_IDLESTKSIZE
#define OS_IDLESTKSIZE         128
#endif

//   <o>Timer Thread stack size [bytes] <64-4096:8><#/4>
//   <i> Defines stack size for Timer thread.
//   <i> Default: 200
#ifndef OS_TIMERSTKSZ
#define OS_TIMERSTKSZ  WORDS_STACK_SIZE
#endif

// <q>Check for stack overflow
// <i> Includes the stack checking code for stack overflow.
// <i> Note that additional code reduces the Kernel performance.
#ifndef OS_STKCHECK
#define OS_STKCHECK    1
#endif

// <o>Processor mode for thread execution
//   <0=> Unprivileged mode
//   <1=> Privileged mode
// <i> Default: Privileged mode
#ifndef OS_RUNPRIV
#define OS_RUNPRIV     1
#endif

// </h>
// <h>SysTick Timer Configuration
// ==============================
//
//   <o>Timer clock value [Hz] <1-1000000000>
//   <i> Defines the timer clock value.
//   <i> Default: 6000000  (6MHz)
#ifndef OS_CLOCK
#  if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_TEENSY3_1)
#    define OS_CLOCK       96000000

#  elif defined(TARGET_LPC1347) || defined(TARGET_STM32F303VC) || defined(TARGET_LPC1549) || defined(TARGET_STM32F334R8) || defined(TARGET_STM32F334C8) || defined(TARGET_STM32F303RE)
#    define OS_CLOCK       72000000

#  elif defined(TARGET_STM32F303K8)
#    define OS_CLOCK       64000000

#  elif defined(TARGET_LPC11U24) || defined(TARGET_LPC11U35_401)  || defined(TARGET_LPC11U35_501) || defined(TARGET_LPCCAPPUCCINO)  || defined(TARGET_LPC1114) || defined(TARGET_KL25Z) \
     || defined(TARGET_KL26Z) || defined(TARGET_KL05Z) || defined(TARGET_KL46Z) || defined(TARGET_KL43Z) || defined(TARGET_STM32F051R8) || defined(TARGET_LPC11U68) || defined(TARGET_STM32F072RB) || defined(TARGET_STM32F091RC)
#    define OS_CLOCK       48000000

#  elif defined(TARGET_LPC812)
#    define OS_CLOCK       36000000

#  elif defined(TARGET_LPC824) || defined(TARGET_SSCI824)
#    define OS_CLOCK       30000000

#  elif  defined(TARGET_STM32F100RB)
#    define OS_CLOCK       24000000

#  elif defined(TARGET_LPC4088) || defined(TARGET_LPC4088_DM) || defined(TARGET_K64F) || defined(TARGET_K22F)
#    define OS_CLOCK       120000000

#  elif defined(TARGET_LPC4330)
#    define OS_CLOCK       204000000

#  elif defined(TARGET_LPC4337)
#    define OS_CLOCK       204000000

#  elif defined(TARGET_STM32F407) || defined(TARGET_F407VG)
#    define OS_CLOCK       168000000

#  elif defined(TARGET_STM32F401RE)
#    define OS_CLOCK       84000000

#  elif defined(TARGET_STM32F411RE)
#     define OS_CLOCK      100000000

#  elif defined(TARGET_STM32F410RB)
#     define OS_CLOCK      100000000

#elif defined(TARGET_STM32F103RB)
#    define OS_CLOCK       72000000

#elif defined(TARGET_STM32F429ZI)
#    define OS_CLOCK       168000000

#elif defined(TARGET_STM32F302R8)
#    define OS_CLOCK       72000000

#elif defined(TARGET_STM32L053R8) || defined(TARGET_STM32L053C8)
#    define OS_CLOCK       32000000

#elif defined(TARGET_STM32F401VC)
#    define OS_CLOCK       84000000

#  elif defined(TARGET_STM32F746NG)
#     define OS_CLOCK      216000000

#elif defined(TARGET_MAX32610) || defined(TARGET_MAX32600)
#    define OS_CLOCK       24000000

#elif defined(TARGET_NZ32_SC151)
#    define OS_CLOCK       32000000

#elif defined(TARGET_STM32L152RE)
#    define OS_CLOCK       24000000

#elif (defined(TARGET_STM32F446RE) || defined(TARGET_STM32F446VE))
#    define OS_CLOCK       180000000

#elif defined(TARGET_STM32F030R8)
#    define OS_CLOCK       48000000

#elif defined(TARGET_STM32F070RB)
#    define OS_CLOCK       48000000

#elif defined(TARGET_STM32L476VG) || defined(TARGET_STM32L476RG)
#    define OS_CLOCK       80000000

#elif defined(TARGET_STM32F469NI)
#    define OS_CLOCK       168000000

#elif defined(TARGET_STM32L152RC)
#    define OS_CLOCK       24000000

#  else
#    error "no target defined"
#  endif
#endif




在这里贴出来,以免大家走弯路。

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2398

主题

6956

帖子

67

粉丝