分享到plurk 分享到twitter 分享到facebook

版本 a7590e8e2af19f7ccb024bd9f614c2cc740f2c25

embedded/nuttx

Changes from a7590e8e2af19f7ccb024bd9f614c2cc740f2c25 to 6677878d549847dc5a5dcb4a6cb511a901258fb6

---
title: nuttx
categories: embedded, arm, stm32, stm32f429
toc: no
...

組員
----
* 翁振育
* 黃亮穎
* 蘇偉嘉
* 李英碩

Nuttx 參考應用
---------------
* `PX4 autopilot<http://pixhawk.org/dev/nuttx/start>`_

NuttX 架構
------------
* 可混用task跟thread。
* 支援FPU。
* 可混用FIFO跟RR。

與平台相關
------------

Run FreeRTOS on STM32F4-Discovery
------------

Task state
------------

.. code-block:: c

 enum tstate_e
 {
     TSTATE_TASK_INVALID    = 0, /* INVALID      - The TCB is uninitialized */
     TSTATE_TASK_PENDING,        /* READY_TO_RUN - Pending preemption unlock */
     TSTATE_TASK_READYTORUN,     /* READY-TO-RUN - But not running */
     TSTATE_TASK_RUNNING,        /* READY_TO_RUN - And running */
     TSTATE_TASK_INACTIVE,       /* BLOCKED      - Initialized but not yet activated */
     TSTATE_WAIT_SEM,            /* BLOCKED      - Waiting for a semaphore */
  #ifndef CONFIG_DISABLE_SIGNALS
     TSTATE_WAIT_SIG,            /* BLOCKED      - Waiting for a signal */
  #endif
  #ifndef CONFIG_DISABLE_MQUEUE
     TSTATE_WAIT_MQNOTEMPTY,     /* BLOCKED      - Waiting for a MQ to become not empty. */
     TSTATE_WAIT_MQNOTFULL,      /* BLOCKED      - Waiting for a MQ to become not full. */
  #endif
  #ifdef CONFIG_PAGING
     TSTATE_WAIT_PAGEFILL,       /* BLOCKED      - Waiting for page fill */
  #endif
     NUM_TASK_STATES             /* Must be last */
 };

Task list 
------------

.. code-block:: c

  typedef struct tasklist_s tasklist_t;
   
  extern volatile dq_queue_t g_readytorun;
  extern volatile dq_queue_t g_pendingtasks;
  extern volatile dq_queue_t g_waitingforsemaphore;
  #ifndef CONFIG_DISABLE_SIGNALS
  extern volatile dq_queue_t g_waitingforsignal;
  #endif
  #ifndef CONFIG_DISABLE_MQUEUE
  extern volatile dq_queue_t g_waitingformqnotempty;
  #endif
  #ifndef CONFIG_DISABLE_MQUEUE
  extern volatile dq_queue_t g_waitingformqnotfull;
  #endif
  #ifdef CONFIG_PAGING
  extern volatile dq_queue_t g_waitingforfill;
  #endif
  extern volatile dq_queue_t g_inactivetasks;
  extern volatile sq_queue_t g_delayed_kufree;
  #if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
  extern volatile sq_queue_t g_delayed_kfree;
  #endif
  extern volatile pid_t g_lastpid;
  extern pidhash_t g_pidhash[CONFIG_MAX_TASKS];
  extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
 
TCB 
------------

Communication
------------

Scheduling
------------

Interrupt handler
------------

測試環境架設
------------

硬體驅動原理
------------
* `UART<embedded/USART>`_
* FPU (Floating Point Unit)

效能表現
--------

參考資料
--------
* https://github.com/deadbeefcafe/nuttx-stm32f4disc-bb
* http://bibliodigital.itcr.ac.cr/xmlui/bitstream/handle/2238/3051/FinalReport.pdf