zoukankan      html  css  js  c++  java
  • stm32f103c8t6移植uCOS Ⅲ出现Error: L6407W,解决方法:内核配置以减小代码规模

    笔者在移植uCOS Ⅲ到stm32f103c8时碰到如下问题

    Error: L6407W: Sections of aggregate size 0x6c48 bytes could not fit into .ANY selector(s).初步推定应该是内核服务没有配置导致,在别人提示下查看了以前stm32f103vet6移植编译成功的ucos Ⅲ工程MAP文件。

    如下:


    考虑到stm32f103c8不用这么多服务,因此拟对内核服务做出裁剪。

    事后验证,事实上不用删除uCOS-IIISource下对应服务的C语言文件,只需找到os_cfg.h文件,对其中不用的服务进行置0操作,MEMORY MANAGEMENT 占用内存较多,而且f103c8不需要内存管理,首先可将其服务置零,然后编译发现已经可以编译通过,代码量差不多是27KB左右,后又对其他不用服务进行了相同操作。最终可将代码量控制在8k左右。

    os_cfg.h文件最终配置如下所示

    #define OS_CFG_APP_HOOKS_EN             0u   /* Enable (1) or Disable (0) application specific hooks                  */
    #define OS_CFG_ARG_CHK_EN               1u   /* Enable (1) or Disable (0) argument checking                           */
    #define OS_CFG_CALLED_FROM_ISR_CHK_EN   1u   /* Enable (1) or Disable (0) check for called from ISR                   */
    #define OS_CFG_DBG_EN                   1u   /* Enable (1) debug code/variables                                       */
    #define OS_CFG_ISR_POST_DEFERRED_EN     1u   /* Enable (1) or Disable (0) Deferred ISR posts                          */
    #define OS_CFG_OBJ_TYPE_CHK_EN          1u   /* Enable (1) or Disable (0) object type checking                        */
    #define OS_CFG_TS_EN                    0u   /* Enable (1) or Disable (0) time stamping                               */


    #define OS_CFG_PEND_MULTI_EN            1u   /* Enable (1) or Disable (0) code generation for multi-pend feature      */


    #define OS_CFG_PRIO_MAX                32u   /* Defines the maximum number of task priorities (see OS_PRIO data type) */


    #define OS_CFG_SCHED_LOCK_TIME_MEAS_EN  0u   /* Include code to measure scheduler lock time                           */
    #define OS_CFG_SCHED_ROUND_ROBIN_EN     0u   /* Include code for Round-Robin scheduling                               */
    #define OS_CFG_STK_SIZE_MIN            64u   /* Minimum allowable task stack size                                     */




                                                 /* ----------------------------- EVENT FLAGS --------------------------- */
    #define OS_CFG_FLAG_EN                  0u   /* Enable (1) or Disable (0) code generation for EVENT FLAGS             */
    #define OS_CFG_FLAG_DEL_EN              0u   /*     Include code for OSFlagDel()                                      */
    #define OS_CFG_FLAG_MODE_CLR_EN         0u   /*     Include code for Wait on Clear EVENT FLAGS                        */
    #define OS_CFG_FLAG_PEND_ABORT_EN       0u   /*     Include code for OSFlagPendAbort()                                */




                                                 /* -------------------------- MEMORY MANAGEMENT ------------------------ */
    #define OS_CFG_MEM_EN                   0u   /* Enable (1) or Disable (0) code generation for MEMORY MANAGER          */




                                                 /* --------------------- MUTUAL EXCLUSION SEMAPHORES ------------------- */
    #define OS_CFG_MUTEX_EN                 0u   /* Enable (1) or Disable (0) code generation for MUTEX                   */
    #define OS_CFG_MUTEX_DEL_EN             0u   /*     Include code for OSMutexDel()                                     */
    #define OS_CFG_MUTEX_PEND_ABORT_EN      0u   /*     Include code for OSMutexPendAbort()                               */




                                                 /* --------------------------- MESSAGE QUEUES -------------------------- */
    #define OS_CFG_Q_EN                     0u   /* Enable (1) or Disable (0) code generation for QUEUES                  */
    #define OS_CFG_Q_DEL_EN                 0u   /*     Include code for OSQDel()                                         */
    #define OS_CFG_Q_FLUSH_EN               0u   /*     Include code for OSQFlush()                                       */
    #define OS_CFG_Q_PEND_ABORT_EN          0u   /*     Include code for OSQPendAbort()                                   */




                                                 /* ----------------------------- SEMAPHORES ---------------------------- */
    #define OS_CFG_SEM_EN                   1u   /* Enable (1) or Disable (0) code generation for SEMAPHORES              */
    #define OS_CFG_SEM_DEL_EN               1u   /*    Include code for OSSemDel()                                        */
    #define OS_CFG_SEM_PEND_ABORT_EN        1u   /*    Include code for OSSemPendAbort()                                  */
    #define OS_CFG_SEM_SET_EN               1u   /*    Include code for OSSemSet()                                        */




                                                 /* -------------------------- TASK MANAGEMENT -------------------------- */
    #define OS_CFG_STAT_TASK_EN             0u   /* Enable (1) or Disable(0) the statistics task                          */
    #define OS_CFG_STAT_TASK_STK_CHK_EN     0u   /* Check task stacks from statistic task                                 */


    #define OS_CFG_TASK_CHANGE_PRIO_EN      0u   /* Include code for OSTaskChangePrio()                                   */
    #define OS_CFG_TASK_DEL_EN              0u   /* Include code for OSTaskDel()                                          */
    #define OS_CFG_TASK_Q_EN                0u   /* Include code for OSTaskQXXXX()                                        */
    #define OS_CFG_TASK_Q_PEND_ABORT_EN     0u   /* Include code for OSTaskQPendAbort()                                   */
    #define OS_CFG_TASK_PROFILE_EN          1u   /* Include variables in OS_TCB for profiling                             */
    #define OS_CFG_TASK_REG_TBL_SIZE        1u   /* Number of task specific registers                                     */
    #define OS_CFG_TASK_SEM_PEND_ABORT_EN   0u   /* Include code for OSTaskSemPendAbort()                                 */
    #define OS_CFG_TASK_SUSPEND_EN          1u   /* Include code for OSTaskSuspend() and OSTaskResume()                   */




                                                 /* -------------------------- TIME MANAGEMENT -------------------------- */
    #define OS_CFG_TIME_DLY_HMSM_EN         1u   /*     Include code for OSTimeDlyHMSM()                                  */
    #define OS_CFG_TIME_DLY_RESUME_EN       1u   /*     Include code for OSTimeDlyResume()                                */




                                                 /* ------------------------- TIMER MANAGEMENT -------------------------- */
    #define OS_CFG_TMR_EN                   0u   /* Enable (1) or Disable (0) code generation for TIMERS                  */
    #define OS_CFG_TMR_DEL_EN               0u   /* Enable (1) or Disable (0) code generation for OSTmrDel()              */

    代码编译后规模如下




  • 相关阅读:
    PHP保留小数的相关方法
    ASP.NET Core MVC 之过滤器(Filter)
    ASP.NET Core MVC 之控制器(Controller)
    ASP.NET Core MVC 之视图组件(View Component)
    ASP.NET Core MVC 之局部视图(Partial Views)
    标签助手(TagHelper)
    ASP.NET Core MVC 之布局(Layout)
    ASP.NET Core MVC 之视图(Views)
    ASP.NET Core MVC 之模型(Model)
    九卷读书:淘宝从小到大的发展 -重读《淘宝技术这十年》
  • 原文地址:https://www.cnblogs.com/siahekai/p/11000826.html
Copyright © 2011-2022 走看看