TODO 145 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847
  1. NuttX TODO List (Last updated September 26, 2019)
  2. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3. This file summarizes known NuttX bugs, limitations, inconsistencies with
  4. standards, things that could be improved, and ideas for enhancements. This
  5. TODO list does not include issues associated with individual board ports. See
  6. also the individual README.txt files in the boards/ sub-directories for
  7. issues related to each board port.
  8. nuttx/:
  9. (16) Task/Scheduler (sched/)
  10. (5) SMP
  11. (1) Memory Management (mm/)
  12. (0) Power Management (drivers/pm)
  13. (5) Signals (sched/signal, arch/)
  14. (2) pthreads (sched/pthread, libs/libc/pthread)
  15. (0) Message Queues (sched/mqueue)
  16. (1) Work Queues (sched/wqueue)
  17. (8) Kernel/Protected Build
  18. (3) C++ Support
  19. (5) Binary loaders (binfmt/)
  20. (17) Network (net/, drivers/net)
  21. (4) USB (drivers/usbdev, drivers/usbhost)
  22. (2) Other drivers (drivers/)
  23. (9) Libraries (libs/libc/, libs/libm/)
  24. (12) File system/Generic drivers (fs/, drivers/)
  25. (10) Graphics Subsystem (graphics/)
  26. (1) Build system / Toolchains
  27. (3) Linux/Cywgin simulation (arch/sim)
  28. (5) ARM (arch/arm/)
  29. apps/ and other Add-Ons:
  30. (1) Network Utilities (apps/netutils/)
  31. (1) NuttShell (NSH) (apps/nshlib)
  32. (1) System libraries apps/system (apps/system)
  33. (1) Modbus (apps/modbus)
  34. (1) Pascal add-on (pcode/)
  35. (5) Other Applications & Tests (apps/examples/)
  36. o Task/Scheduler (sched/)
  37. ^^^^^^^^^^^^^^^^^^^^^^^
  38. Title: CHILD PTHREAD TERMINATION
  39. Description: When a tasks exits, shouldn't all of its child pthreads also be
  40. terminated?
  41. This behavior was implemented as an options controlled by the
  42. configuration setting CONFIG_SCHED_EXIT_KILL_CHILDREN. This
  43. option must be used with caution, however. It should not be
  44. used unless you are certain of what you are doing. Uninformed
  45. of this option can often lead to memory leaks since, for
  46. example, memory allocations held by threads are not
  47. automatically freed!
  48. Status: Closed. No, this behavior will not be implemented unless
  49. specifically selected.
  50. Priority: Medium, required for good emulation of process/pthread model.
  51. The current behavior allows for the main thread of a task to
  52. exit() and any child pthreads will persist. That does raise
  53. some issues: The main thread is treated much like just-another-
  54. pthread but must follow the semantics of a task or a process.
  55. That results in some inconsistencies (for example, with robust
  56. mutexes, what should happen if the main thread exits while
  57. holding a mutex?)
  58. Title: pause() NON-COMPLIANCE
  59. Description: In the POSIX description of this function the pause() function
  60. must suspend the calling thread until delivery of a signal whose
  61. action is either to execute a signal-catching function or to
  62. terminate the process. The current implementation only waits for
  63. any non-blocked signal to be received. It should only wake up if
  64. the signal is delivered to a handler.
  65. Status: Open.
  66. Priority: Medium Low.
  67. Title: ON-DEMAND PAGING INCOMPLETE
  68. Description: On-demand paging has recently been incorporated into the RTOS.
  69. The design of this feature is described here:
  70. http://www.nuttx.org/NuttXDemandPaging.html.
  71. As of this writing, the basic feature implementation is
  72. complete and much of the logic has been verified. The test
  73. harness for the feature exists only for the NXP LPC3131 (see
  74. boards/arm/lpc31xx/ea3131/configs/pgnsh and locked
  75. directories). There are some limitations of this testing so
  76. I still cannot say that the feature is fully functional.
  77. Status: Open. This has been put on the shelf for some time.
  78. Priority: Medium-Low
  79. Title: GET_ENVIRON_PTR()
  80. Description: get_environ_ptr() (sched/sched_getenvironptr.c) is not implemented.
  81. The representation of the environment strings selected for
  82. NuttX is not compatible with the operation. Some significant
  83. re-design would be required to implement this function and that
  84. effort is thought to be not worth the result.
  85. Status: Open. No change is planned.
  86. Priority: Low -- There is no plan to implement this.
  87. Title: TIMER_GETOVERRUN()
  88. Description: timer_getoverrun() (sched/timer_getoverrun.c) is not implemented.
  89. Status: Open
  90. Priority: Low -- There is no plan to implement this.
  91. Title: INCOMPATIBILITIES WITH execv() AND execl()
  92. Description: Simplified 'execl()' and 'execv()' functions are provided by
  93. NuttX. NuttX does not support processes and hence the concept
  94. of overlaying a tasks process image with a new process image
  95. does not make any sense. In NuttX, these functions are
  96. wrapper functions that:
  97. 1. Call the non-standard binfmt function 'exec', and then
  98. 2. exit(0).
  99. As a result, the current implementations of 'execl()' and
  100. 'execv()' suffer from some incompatibilities, the most
  101. serious of these is that the exec'ed task will not have
  102. the same task ID as the vfork'ed function. So the parent
  103. function cannot know the ID of the exec'ed task.
  104. Status: Open
  105. Priority: Medium Low for now
  106. Title: ISSUES WITH atexit(), on_exit(), AND pthread_cleanup_pop()
  107. Description: These functions execute with the following bad properties:
  108. 1. They run with interrupts disabled,
  109. 2. They run in supervisor mode (if applicable), and
  110. 3. They do not obey any setup of PIC or address
  111. environments. Do they need to?
  112. 4. In the case of task_delete() and pthread_cancel() without
  113. deferred cancellation, these callbacks will run on the
  114. thread of execution and address context of the caller of
  115. task_delete() or pthread_cancel(). That is very bad!
  116. The fix for all of these issues it to have the callbacks
  117. run on the caller's thread as is currently done with
  118. signal handlers. Signals are delivered differently in
  119. PROTECTED and KERNEL modes: The delivery involves a
  120. signal handling trampoline function in the user address
  121. space and two signal handlers: One to call the signal
  122. handler trampoline in user mode (SYS_signal_handler) and
  123. on in with the signal handler trampoline to return to
  124. supervisor mode (SYS_signal_handler_return)
  125. The primary difference is in the location of the signal
  126. handling trampoline:
  127. - In PROTECTED mode, there is on a single user space blob
  128. with a header at the beginning of the block (at a well-
  129. known location. There is a pointer to the signal handler
  130. trampoline function in that header.
  131. - In the KERNEL mode, a special process signal handler
  132. trampoline is used at a well-known location in every
  133. process address space (ARCH_DATA_RESERVE->ar_sigtramp).
  134. Status: Open
  135. Priority: Medium Low. This is an important change to some less
  136. important interfaces. For the average user, these
  137. functions are just fine the way they are.
  138. Title: execv() AND vfork()
  139. Description: There is a problem when vfork() calls execv() (or execl()) to
  140. start a new application: When the parent thread calls vfork()
  141. it receives and gets the pid of the vforked task, and *not*
  142. the pid of the desired execv'ed application.
  143. The same tasking arrangement is used by the standard function
  144. posix_spawn(). However, posix_spawn uses the non-standard, internal
  145. NuttX interface task_reparent() to replace the child's parent task
  146. with the caller of posix_spawn(). That cannot be done with vfork()
  147. because we don't know what vfork() is going to do.
  148. Any solution to this is either very difficult or impossible without
  149. an MMU.
  150. Status: Open
  151. Priority: Low (it might as well be low since it isn't going to be fixed).
  152. Title: errno IS NOT SHARED AMONG THREADS
  153. Description: In NuttX, the errno value is unique for each thread. But for
  154. bug-for-bug compatibility, the same errno should be shared by
  155. the task and each thread that it creates. It is *very* easy
  156. to make this change: Just move the pterrno field from
  157. struct tcb_s to struct task_group_s. However, I am still not
  158. sure if this should be done or not.
  159. NOTE: glibc behaves this way unless __thread is defined then,
  160. in that case, it behaves like NuttX (using TLS to save the
  161. thread local errno).
  162. Status: Closed. The existing solution is better and compatible with
  163. thread-aware GLIBC (although its incompatibilities could show
  164. up in porting some code). I will retain this issue for
  165. reference only.
  166. Priority: N/A
  167. Title: SCALABILITY
  168. Description: Task control information is retained in simple lists. This
  169. is completely appropriate for small embedded systems where
  170. the number of tasks, N, is relatively small. Most list
  171. operations are O(N). This could become an issue if N gets
  172. very large.
  173. In that case, these simple lists should be replaced with
  174. something more performant such as a balanced tree in the
  175. case of ordered lists. Fortunately, most internal lists are
  176. hidden behind simple accessor functions and so the internal
  177. data structures can be changed if need with very little impact.
  178. Explicitly reference to the list structure are hidden behind
  179. the macro this_task().
  180. Status: Open
  181. Priority: Low. Things are just the way that we want them for the way
  182. that NuttX is used today.
  183. Title: INTERNAL VERSIONS OF USER FUNCTIONS
  184. Description: The internal NuttX logic uses the same interfaces as does
  185. the application. That sometime produces a problem because
  186. there is "overloaded" functionality in those user interfaces
  187. that are not desirable.
  188. For example, having cancellation points hidden inside of the
  189. OS can cause non-cancellation point interfaces to behave
  190. strangely.
  191. Here is another issue:  Internal OS functions should not set
  192. errno and should never have to look at the errno value to
  193. determine the cause of the failure.  The errno is provided
  194. for compatibility with POSIX application interface
  195. requirements and really doesn't need to be used within the
  196. OS.
  197. Both of these could be fixed if there were special internal
  198. versions these functions.  For example, there could be a an
  199. nxsem_wait() that does all of the same things as sem_wait()
  200. was does not create a cancellation point and does not set
  201. the errno value on failures.
  202. Everything inside the OS would use nx_sem_wait().
  203. Applications would call sem_wait() which would just be a
  204. wrapper around nx_sem_wait() that adds the cancellation point
  205. and that sets the errno value on failures.
  206. On particularly difficult issue is the use of common memory
  207. manager C, and NX libraries in the build. For the PROTECTED
  208. and KERNEL builds, this issue is resolved. In that case,
  209. The OS links with a different version of the libraries than
  210. does the application: The OS version would use the OS internal
  211. interfaces and the application would use the standard
  212. interfaces.
  213. But for the FLAT build, both the OS and the applications use
  214. the same library functions. For applications, the library
  215. functions *must* support errno's and cancellation and, hence,
  216. these are also used within the OS.
  217. But that raises yet another issue: If the application
  218. version of the libraries use the standard interfaces
  219. internally, then they may generate unexpected cancellation
  220. points. For example, the memory management would take a
  221. semaphore using sem_wait() to get exclusive access to the
  222. heap. That means that every call to malloc() and free()
  223. would be a cancellation point, a clear POSIX violation.
  224. Changes like that could clean up some of this internal
  225. craziness.
  226. UPDATE:
  227. 2017-10-03: This change has been completed for the case of
  228. semaphores used in the OS. Still need to checkout signals
  229. and messages queues that are also used in the OS. Also
  230. backed out commit b4747286b19d3b15193b2a5e8a0fe48fa0a8638c.
  231. 2017-10-06: This change has been completed for the case of
  232. signals used in the OS. Still need to checkout messages
  233. queues that are also used in the OS.
  234. 2017-10-10: This change has been completed for the case of
  235. message queue used in the OS. I am keeping this issue
  236. open because (1) there are some known remaining calls that
  237. that will modify the errno (such as dup(), dup2(),
  238. task_activate(), kthread_create(), exec(), mq_open(),
  239. mq_close(), and others) and (2) there may still be calls that
  240. create cancellation points. Need to check things like open(),
  241. close(), read(), write(), and possibly others.
  242. 2018-01-30: This change has been completed for the case of
  243. scheduler functions used within the OS: sched_getparam(),
  244. sched_setparam(), sched_getscheduler(), sched_setschedule(),
  245. and sched_setaffinity(),
  246. 2018-09-15: This change has been completed for the case of
  247. open() used within the OS. There are places under libs/ and
  248. boards/ that have not been converted. I also note cases
  249. where fopen() is called under libs/libc/netdb/.
  250. 2019-09-11: built_isavail() no longer sets the errno variable.
  251. Status: Open
  252. Priority: Low. Things are working OK the way they are. But the design
  253. could be improved and made a little more efficient with this
  254. change.
  255. Task: IDLE THREAD TCB SETUP
  256. Description: There are issues with setting IDLE thread stacks:
  257. 1. One problem is stack-related data in the IDLE threads TCB.
  258. A solution might be to standardize the use of g_idle_topstack.
  259. That you could add initialization like this in nx_start:
  260. @@ -344,6 +347,11 @@ void nx_start(void)
  261. g_idleargv[1] = NULL;
  262. g_idletcb.argv = g_idleargv;
  263. + /* Set the IDLE task stack size */
  264. +
  265. + g_idletcb.cmn.adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE;
  266. + g_idletcb.cmn.stack_alloc_ptr = (void *)(g_idle_topstack - CONFIG_IDLETHREAD_STACKSIZE);
  267. +
  268. /* Then add the idle task's TCB to the head of the ready to run list */
  269. dq_addfirst((FAR dq_entry_t *)&g_idletcb, (FAR dq_queue_t *)&g_readytorun);
  270. The g_idle_topstack variable is available for almost all architectures:
  271. $ find . -name *.h | xargs grep g_idle_top
  272. ./arm/src/common/up_internal.h:EXTERN const uint32_t g_idle_topstack;
  273. ./avr/src/avr/avr.h:extern uint16_t g_idle_topstack;
  274. ./avr/src/avr32/avr32.h:extern uint32_t g_idle_topstack;
  275. ./hc/src/common/up_internal.h:extern uint16_t g_idle_topstack;
  276. ./mips/src/common/up_internal.h:extern uint32_t g_idle_topstack;
  277. ./misoc/src/lm32/lm32.h:extern uint32_t g_idle_topstack;
  278. ./renesas/src/common/up_internal.h:extern uint32_t g_idle_topstack;
  279. ./renesas/src/m16c/chip.h:extern uint32_t g_idle_topstack; /* Start of the heap */
  280. ./risc-v/src/common/up_internal.h:EXTERN uint32_t g_idle_topstack;
  281. ./x86/src/common/up_internal.h:extern uint32_t g_idle_topstack;
  282. That omits these architectures: sh1, sim, xtensa, z16, z80,
  283. ez80, and z8. All would have to support this common
  284. global variable.
  285. Also, the stack itself may be 8-, 16-, or 32-bits wide,
  286. depending upon the architecture and do have differing
  287. alignment requirements.
  288. 2. Another problem is colorizing that stack to use with
  289. stack usage monitoring logic. There is logic in some
  290. start functions to do this in a function called go_nx_start.
  291. It is available in these architectures:
  292. ./arm/src/efm32/efm32_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  293. ./arm/src/kinetis/kinetis_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  294. ./arm/src/sam34/sam_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  295. ./arm/src/samv7/sam_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  296. ./arm/src/stm32/stm32_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  297. ./arm/src/stm32f7/stm32_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  298. ./arm/src/stm32l4/stm32l4_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  299. ./arm/src/tms570/tms570_boot.c:static void go_nx_start(void *pv, unsigned int nbytes)
  300. ./arm/src/xmc4/xmc4_start.c:static void go_nx_start(void *pv, unsigned int nbytes)
  301. But no others.
  302. Status: Open
  303. Priority: Low, only needed for more complete debug.
  304. Title: PRIORITY INHERITANCE WITH SPORADIC SCHEDULER
  305. Description: The sporadic scheduler manages CPU utilization by a task by
  306. alternating between a high and a low priority. In either
  307. state, it may have its priority boosted. However, under
  308. some circumstances, it is impossible in the current design to
  309. switch to the correct priority if a semaphore held by the
  310. sporadic thread is participating in priority inheritance:
  311. There is an issue when switching from the high to the low
  312. priority state. If the priority was NOT boosted above the
  313. higher priority, it still may still need to boosted with
  314. respect to the lower priority. If the highest priority
  315. thread waiting on a semaphore held by the sporadic thread is
  316. higher in priority than the low priority but less than the
  317. higher priority, then new thread priority should be set to
  318. that middle priority, not to the lower priority.
  319. In order to do this we would need to know the highest
  320. priority from among all tasks waiting for the all semaphores
  321. held by the sporadic task. That information could be
  322. retained by the priority inheritance logic for use by the
  323. sporadic scheduler. The boost priority could be retained in
  324. a new field of the TCB (say, pend_priority). That
  325. pend_priority could then be used when switching from the
  326. higher to the lower priority.
  327. Status: Open
  328. Priority: Low. Does anyone actually use the sporadic scheduler?
  329. Title: SIMPLIFY SPORADIC SCHEDULER DESIGN
  330. Description: I have been planning to re-implement sporadic scheduling for
  331. some time. I believe that the current implementation is
  332. unnecessarily complex. There is no clear statement for the
  333. requirements of sporadic scheduling that I could find, so I
  334. based the design on some behaviors of another OS that I saw
  335. published (QNX as I recall).
  336. But I think that the bottom line requirement for sporadic
  337. scheduling is that is it should make a best attempt to
  338. control a fixed percentage of CPU bandwidth for a task in
  339. during an interval only by modifying it is priority between
  340. a low and a high priority. The current design involves
  341. several timers: A "budget" timer plus a variable number of
  342. "replenishment" timers and a lot of nonsense to duplicate QNX
  343. behavior that I think I not necessary.
  344. It think that the sporadic scheduler could be re-implemented
  345. with only the single "budget" timer. Instead of starting a
  346. new "replenishment" timer when the task is resumed, that
  347. single timer could just be extended.
  348. Status: Open
  349. Priority: Low. This is an enhancement. And does anyone actually use
  350. the sporadic scheduler?
  351. Title: REMOVE NESTED CANCELLATION POINT SUPPORT
  352. Description: The current implementation support nested cancellation points.
  353. The TCB field cpcount keeps track of that nesting level.
  354. However, cancellation points should not be calling other
  355. cancellation points so this design could be simplified by
  356. removing all support for nested cancellation points.
  357. Status: Open
  358. Priority: Low. No harm is being done by the current implementation.
  359. This change is primarily for aesthetic reasons. If would
  360. reduce memory usage by a very small but probably
  361. insignificant amount.
  362. Title: DAEMONIZE ELF PROGRAM
  363. Description: It is a common practice to "daemonize" to detach a task from
  364. its parent. This is used with NSH, for example, so that NSH
  365. will not stall, waiting in waitpid() for the child task to
  366. exit.
  367. Daemonization is done to creating a new task which continues
  368. to run while the original task exits (sending the SIGCHLD
  369. signal to the parent and awakening waitpid()). In a pure
  370. POSIX system, this is down with fork(), perhaps like:
  371. if (fork() != 0)
  372. {
  373. exit();
  374. }
  375. but is usually done with task_create() in NuttX. But when
  376. task_create() is called from within an ELF program, a very
  377. perverse situation is created:
  378. The basic problem involves address environments and task groups:
  379. "Task groups" are emulations of Linux processes. For the
  380. case of the FLAT, ELF module, the address environment is
  381. allocated memory that contains the ELF module.
  382. When you call task_create() from the ELF program, you now
  383. have two task groups running in the same address environment.
  384. That is a perverse situation for which there is no standard
  385. solution. There is nothing comparable to that. Even in
  386. Linux, fork() creates another address environment (although
  387. it is an exact copy of the original).
  388. When the ELF program was created, the function exec() in
  389. binfmt/binfmt_exec.c runs. It sets up a call back that will
  390. be invoked when the ELF program exits.
  391. When ELF program exits, the address environment is destroyed
  392. and the other task running in the same address environment is
  393. then running in stale memory and will eventually crash.
  394. Nothing special happens when the other created task running
  395. in the allocated address environment exits since has no such
  396. call backs.
  397. In order to make this work you would need logic like:
  398. 1. When the ELF task calls task_create(), it would need to:
  399. a. Detect that task_create() was called from an ELF program,
  400. b. increment a reference count on the address environment, and
  401. c. Set up the same exit hook for the newly created task.
  402. 2. Then when either the ELF program task or the created task
  403. in the same address environment exits, it would decrement
  404. the reference count. When the last task exits, the reference
  405. count would go to zero and the address environement could be
  406. destroyed.
  407. This is complex work and would take some effort and probably
  408. requires redesign of existing code and interfaces to get a
  409. proper, clean, modular solution.
  410. Status: Open
  411. Priority: Medium-Low. A simple work-arounds when using NSH is to use
  412. the '&' postfix to put the started ELF program into background.
  413. o SMP
  414. ^^^
  415. Title: SMP AND DATA CACHES
  416. Description: When spinlocks, semaphores, etc. are used in an SMP system with
  417. a data cache, then there may be problems with cache coherency
  418. in some CPU architectures: When one CPU modifies the shared
  419. object, the changes may not be visible to another CPU if it
  420. does not share the data cache. That would cause failure in
  421. the IPC logic.
  422. Flushing the D-cache on writes and invalidating before a read is
  423. not really an option. That would essentially effect every memory
  424. access and there may be side-effects due to cache line sizes
  425. and alignment.
  426. For the same reason a separate, non-cacheable memory region is
  427. not an option. Essentially all data would have to go in the
  428. non-cached region and you would have no benefit from the data
  429. cache.
  430. On ARM Cortex-A, each CPU has a separate data cache. However,
  431. the MPCore's Snoop Controller Unit supports coherency among
  432. the different caches. The SCU is enabled by the SCU control
  433. register and each CPU participates in the SMP coherency by
  434. setting the ACTLR_SMP bit in the auxiliary control register
  435. (ACTLR).
  436. Status: Closed
  437. Priority: High on platforms that may have the issue.
  438. Title: MISUSE OF sched_lock() IN SMP MODE
  439. Description: The OS API sched_lock() disables pre-emption and locks a
  440. task in place. In the single CPU case, it is also often
  441. used to enforce a simple critical section since not other
  442. task can run while pre-emption is locked.
  443. This, however, does not generalize to the SMP case. In the
  444. SMP case, there are multiple tasks running on multiple CPUs.
  445. The basic behavior is still correct: The task that has
  446. locked pre-emption will not be suspended. However, there
  447. is no longer any protection for use as a critical section:
  448. tasks running on other CPUs may still execute that
  449. unprotected code region.
  450. The solution is to replace the use of sched_lock() with
  451. stronger protection such as spin_lock_irqsave().
  452. Status: Open
  453. Priority: Medium for SMP system. Not critical to single CPU systems.
  454. NOTE: There are no known bugs from this potential problem.
  455. Title: CORTEX-A GIC SGI INTERRUPT MASKING
  456. Description: In the ARMv7-A GICv2 architecture, the inter-processor
  457. interrupts (SGIs) are non maskable and will occur even if
  458. interrupts are disabled. This adds a lot of complexity
  459. to the ARMV7-A critical section design.
  460. Masayuki Ishikawa has suggested the use of the GICv2 ICCMPR
  461. register to control SGI interrupts. This register (much like
  462. the ARMv7-M BASEPRI register) can be used to mask interrupts
  463. by interrupt priority. Since SGIs may be assigned priorities
  464. the ICCMPR should be able to block execution of SGIs as well.
  465. Such an implementation would be very similar to the BASEPRI
  466. (vs PRIMASK) implementation for the ARMv7-M: (1) The
  467. up_irq_save() and up_irq_restore() registers would have to
  468. set/restore the ICCMPR register, (2) register setup logic in
  469. arch/arm/src/armv7-a for task start-up and signal dispatch
  470. would have to set the ICCMPR correctly, and (3) the 'xcp'
  471. structure would have to be extended to hold the ICCMPR
  472. register; logic would have to added be save/restore the
  473. ICCMPR register in the 'xcp' structure on each interrupt and
  474. context switch.
  475. This would also be an essential part of a high priority,
  476. nested interrupt implementation (unrelated).
  477. Status: Open
  478. Priority: Low. There are no known issues with the current non-maskable
  479. SGI implementation. This change would, however, lead to
  480. simplification in the design and permit commonality with
  481. other, non-GIC implementations.
  482. Title: ISSUES WITH ACCESSING CPU INDEX
  483. Description: The CPU number is accessed usually with the macro this_cpu().
  484. The returned CPU number is then used for various things,
  485. typically as an array index. However, if pre-emption is
  486. not disabled,then it is possible that a context switch
  487. could occur and that logic could run on anothe CPU with
  488. possible fatal consequences.
  489. We need to evaluate all use of this_cpu() and assure that
  490. it is used in a way that guarantees the the code continues
  491. to execute on the same CPU.
  492. Status: Open
  493. Prioity: Medium. This is a logical problem but I have nevers seen
  494. an bugs caused by this. But I believe that failures are
  495. possible.
  496. Title: POSSIBLE FOR TWO CPUs TO HOLD A CRITICAL SECTION?
  497. Description: The SMP design includes logic that will support multiple
  498. CPUs holding a critical section. Is this necessary? How
  499. can that occur? I think it can occur in the following
  500. situation:
  501. CPU0 - Task A is running.
  502. - The CPU0 IDLE task is the only other task in the
  503. CPU0 ready-to-run list.
  504. CPU1 - Task B is running.
  505. - Task C is blocked but remains in the g_assignedtasks[]
  506. list because of a CPU affinity selection. Task C
  507. also holds the critical section which is temporarily
  508. relinquished because Task C is blocked by Task B.
  509. - The CPU1 IDLE task is at the end of the list.
  510. Actions:
  511. 1. Task A/CPU 0 takes the critical section.
  512. 2. Task B/CPU 1 suspends waiting for an event
  513. 3. Task C is restarted.
  514. Now both Task A and Task C hold the critical section.
  515. This problem has never been observed, but seems to be a
  516. possibility. I believe it could only occur if CPU affinity
  517. is used (otherwise, tasks will pend must as when pre-
  518. emption is disabled).
  519. A proper solution would probably involve re-designing how
  520. CPU affinity is implemented. The CPU1 IDLE thread should
  521. more appropriately run, but cannot because the Task C TCB
  522. is in the g_assignedtasks[] list.
  523. Status: Open
  524. Priority: Unknown. Might be high, but first we would need to confirm
  525. that this situation can occur and that is actually causes
  526. a failure.
  527. o Memory Management (mm/)
  528. ^^^^^^^^^^^^^^^^^^^^^^^
  529. Title: FREE MEMORY ON TASK EXIT
  530. Description: Add an option to free all memory allocated by a task when the
  531. task exits. This is probably not be worth the overhead for a
  532. deeply embedded system.
  533. There would be complexities with this implementation as well
  534. because often one task allocates memory and then passes the
  535. memory to another: The task that "owns" the memory may not
  536. be the same as the task that allocated the memory.
  537. Update. From the NuttX forum:
  538. ...there is a good reason why task A should never delete task B.
  539. That is because you will strand memory resources. Another feature
  540. lacking in most flat address space RTOSs is automatic memory
  541. clean-up when a task exits.
  542. That behavior just comes for free in a process-based OS like Linux:
  543. Each process has its own heap and when you tear down the process
  544. environment, you naturally destroy the heap too.
  545. But RTOSs have only a single, shared heap. I have spent some time
  546. thinking about how you could clean up memory required by a task
  547. when a task exits. It is not so simple. It is not as simple as
  548. just keeping memory allocated by a thread in a list then freeing
  549. the list of allocations when the task exists.
  550. It is not that simple because you don't know how the memory is
  551. being used. For example, if task A allocates memory that is used
  552. by task B, then when task A exits, you would not want to free that
  553. memory needed by task B. In a process-based system, you would
  554. have to explicitly map shared memory (with reference counting) in
  555. order to share memory. So the life of shared memory in that
  556. environment is easily managed.
  557. I have thought that the way that this could be solved in NuttX
  558. would be: (1) add links and reference counts to all memory allocated
  559. by a thread. This would increase the memory allocation overhead!
  560. (2) Keep the list head in the TCB, and (3) extend mmap() and munmap()
  561. to include the shared memory operations (which would only manage
  562. the reference counting and the life of the allocation).
  563. Then what about pthreads? Memory should not be freed until the last
  564. pthread in the group exists. That could be done with an additional
  565. reference count on the whole allocated memory list (just as streams
  566. and file descriptors are now shared and persist until the last
  567. pthread exits).
  568. I think that would work but to me is very unattractive and
  569. inconsistent with the NuttX "small footprint" objective. ...
  570. Other issues:
  571. - Memory free time would go up because you would have to remove
  572. the memory from that list in free().
  573. - There are special cases inside the RTOS itself. For example,
  574. if task A creates task B, then initial memory allocations for
  575. task B are created by task A. Some special allocators would
  576. be required to keep this memory on the correct list (or on
  577. no list at all).
  578. Updated 2016-06-25:
  579. For processors with an MMU (Memory Management Unit), NuttX can be
  580. built in a kernel mode. In that case, each process will have a
  581. local copy of its heap (filled with sbrk()) and when the process
  582. exits, its local heap will be destroyed and the underlying page
  583. memory is recovered.
  584. So in this case, NuttX work just link Linux or or *nix systems:
  585. All memory allocated by processes or threads in processes will
  586. be recovered when the process exits.
  587. But not for the flat memory build. In that case, the issues
  588. above do apply. There is no safe way to recover the memory in
  589. that case (and even if there were, the additional overhead would
  590. not be acceptable on most platforms).
  591. This does not prohibit anyone from creating a wrapper for malloc()
  592. and an atexit() callback that frees memory on task exit. People
  593. are free and, in fact, encouraged, to do that. However, since
  594. it is inherently unsafe, I would never incorporate anything
  595. like that into NuttX.
  596. Status: Open. No changes are planned. NOTE: This applies to the FLAT
  597. and PROTECTED builds only. There is no such leaking of memory
  598. in the KERNEL build mode.
  599. Priority: Medium/Low, a good feature to prevent memory leaks but would
  600. have negative impact on memory usage and code size.
  601. o Power Management (drivers/pm)
  602. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  603. o Signals (sched/signal, arch/)
  604. ^^^^^^^^^^^^^^^^^^^^^^^
  605. Title: STANDARD SIGNALS
  606. Description: 'Standard' signals and signal actions are not fully
  607. supported. The SIGCHLD signal is supported and, if the
  608. option CONFIG_SIG_DEFAULT=y is included, some signals will
  609. perform their default actions (dependent upon addition
  610. configuration settings):
  611. Signal Action Additional Configuration
  612. ------- -------------------- -------------------------
  613. SIGUSR1 Abnormal Termination CONFIG_SIG_SIGUSR1_ACTION
  614. SIGUSR2 Abnormal Termination CONFIG_SIG_SIGUSR2_ACTION
  615. SIGALRM Abnormal Termination CONFIG_SIG_SIGALRM_ACTION
  616. SIGPOLL Abnormal Termination CONFIG_SIG_SIGPOLL_ACTION
  617. SIGSTOP Suspend task CONFIG_SIG_SIGSTOP_ACTION
  618. SIGSTP Suspend task CONFIG_SIG_SIGSTOP_ACTION
  619. SIGCONT Resume task CONFIG_SIG_SIGSTOP_ACTION
  620. SIGINT Abnormal Termination CONFIG_SIG_SIGKILL_ACTION
  621. SIGKILL Abnormal Termination CONFIG_SIG_SIGKILL_ACTION
  622. Status: Open. No further changes are planned.
  623. Priority: Low, required by standards but not so critical for an
  624. embedded system.
  625. Title: SIGEV_THREAD
  626. Description: Implementation of support for support for SIGEV_THREAD is available
  627. only in the FLAT build mode because it uses the OS work queues to
  628. perform the callback. The alternative for the PROTECTED and KERNEL
  629. builds would be to create pthreads in the user space to perform the
  630. callbacks. That is not a very attractive solution due to performance
  631. issues. It would also require some additional logic to specify the
  632. TCB of the parent so that the pthread could be bound to the correct
  633. group.
  634. There is also some user-space logic in libs/libc/aio/lio_listio.c.
  635. That logic could use the user-space work queue for the callbacks.
  636. Status: Low, there are alternative designs. However, these features
  637. are required by the POSIX standard.
  638. Priority: Low for now
  639. Title: SIGNAL NUMBERING
  640. Description: In signal.h, the range of valid signals is listed as 0-31. However,
  641. in many interfaces, 0 is not a valid signal number. The valid
  642. signal number should be 1-32. The signal set operations would need
  643. to map bits appropriately.
  644. Status: Open
  645. Priority: Low. Even if there are only 31 usable signals, that is still a lot.
  646. Title: NO QUEUING of SIGNAL ACTIONS
  647. Description: In the architecture specific implemenation of struct xcptcontext,
  648. there are fields used by signal handling logic to pass the state
  649. information needed to dispatch signal actions to the appropriate
  650. handler.
  651. There is only one copy of this state information in the
  652. implementations of struct xcptcontext and, as a consequence,
  653. if there is a signal handler executing on a thread, then addition
  654. signal actions will be lost until that signal handler completes
  655. and releases those resources.
  656. Status: Open
  657. Priority: Low. This design flaw has been around for ages and no one has yet
  658. complained about it. Apparently the visibility of the problem is
  659. very low.
  660. Title: QUEUED SIGNAL ACTIONS ARE INAPPROPRIATELY DEFERRED
  661. Descirption: The implement of nxsig_deliver() does the followin in a loop:
  662. - It takes the next next queued signal action from a list
  663. - Calls the architecture-specific up_sigdeliver() to perform
  664. the signal action (through some sleight of hand in
  665. up_schedule_sigaction())
  666. - up_sigdeliver() is a trampoline function that performs the
  667. actual signal action as well as some housekeeping functions
  668. then
  669. - up_sigdeliver() performs a context switch back to the normal,
  670. uninterrupted thread instead of returning to nxsig_deliver().
  671. The loop in nxsig_deliver() then will have the opportunity to
  672. run until when that normal, uniterrupted thread is suspended.
  673. Then the loop will continue with the next queued signal
  674. action.
  675. Normally signals execute immediately. The is the whole reason
  676. why almost all blocking APIs return when a signal is received
  677. (with errno equal to EINTR).
  678. Status: Open
  679. Priority: Low. This design flaw has been around for ages and no one has yet
  680. complained about it. Apparently the visibility of the problem is
  681. very low.
  682. o pthreads (sched/pthreads libs/libc/pthread)
  683. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  684. Title: PTHREAD_PRIO_PROTECT
  685. Description: Extend pthread_mutexattr_setprotocol(). It should support
  686. PTHREAD_PRIO_PROTECT (and so should its non-standard counterpart
  687. sem_setproto()).
  688. "When a thread owns one or more mutexes initialized with the
  689. PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its
  690. priority or the highest of the priority ceilings of all the mutexes
  691. owned by this thread and initialized with this attribute, regardless of
  692. whether other threads are blocked on any of these mutexes or not.
  693. "While a thread is holding a mutex which has been initialized with
  694. the PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT protocol attributes,
  695. it shall not be subject to being moved to the tail of the scheduling queue
  696. at its priority in the event that its original priority is changed,
  697. such as by a call to sched_setparam(). Likewise, when a thread unlocks
  698. a mutex that has been initialized with the PTHREAD_PRIO_INHERIT or
  699. PTHREAD_PRIO_PROTECT protocol attributes, it shall not be subject to
  700. being moved to the tail of the scheduling queue at its priority in the
  701. event that its original priority is changed."
  702. Status: Open. No changes planned.
  703. Priority: Low -- about zero, probably not that useful. Priority inheritance is
  704. already supported and is a much better solution. And it turns out
  705. that priority protection is just about as complex as priority inheritance.
  706. Excerpted from my post in a Linked-In discussion:
  707. "I started to implement this HLS/"PCP" semaphore in an RTOS that I
  708. work with (http://www.nuttx.org) and I discovered after doing the
  709. analysis and basic code framework that a complete solution for the
  710. case of a counting semaphore is still quite complex -- essentially
  711. as complex as is priority inheritance.
  712. "For example, suppose that a thread takes 3 different HLS semaphores
  713. A, B, and C. Suppose that they are prioritized in that order with
  714. A the lowest and C the highest. Suppose the thread takes 5 counts
  715. from A, 3 counts from B, and 2 counts from C. What priority should
  716. it run at? It would have to run at the priority of the highest
  717. priority semaphore C. This means that the RTOS must maintain
  718. internal information of the priority of every semaphore held by
  719. the thread.
  720. "Now suppose it releases one count on semaphore B. How does the
  721. RTOS know that it still holds 2 counts on B? With some complex
  722. internal data structure. The RTOS would have to maintain internal
  723. information about how many counts from each semaphore are held
  724. by each thread.
  725. "How does the RTOS know that it should not decrement the priority
  726. from the priority of C? Again, only with internal complexity. It
  727. would have to know the priority of every semaphore held by
  728. every thread.
  729. "Providing the HLS capability on a simple pthread mutex would not
  730. be such quite such a complex job if you allow only one mutex per
  731. thread. However, the more general case seems almost as complex
  732. as priority inheritance. I decided that the implementation does
  733. not have value to me. I only wanted it for its reduced
  734. complexity; in all other ways I believe that it is the inferior
  735. solution. So I discarded a few hours of programming. Not a
  736. big loss from the experience I gained."
  737. Title: INAPPROPRIATE USE OF sched_lock() BY pthreads
  738. Description: In implementation of standard pthread functions, the non-
  739. standard, NuttX function sched_lock() is used. This is very
  740. strong since it disables pre-emption for all threads in all
  741. task groups. I believe it is only really necessary in most
  742. cases to lock threads in the task group with a new non-
  743. standard interface, say pthread_lock().
  744. This is because the OS resources used by a thread such as
  745. mutexes, condition variable, barriers, etc. are only
  746. meaningful from within the task group. So, in order to
  747. performance exclusive operations on these resources, it is
  748. only necessary to block other threads executing within the
  749. task group.
  750. This is an easy change: pthread_lock() and pthread_unlock()
  751. would simply operate on a semaphore retained in the task
  752. group structure. I am, however, hesitant to make this change:
  753. In the FLAT build model, there is nothing that prevents people
  754. from accessing the inter-thread controls from threads in
  755. different task groups. Making this change, while correct,
  756. might introduce subtle bugs in code by people who are not
  757. using NuttX correctly.
  758. Status: Open
  759. Priority: Low. This change would improve real-time performance of the
  760. OS but is not otherwise required.
  761. o Message Queues (sched/mqueue)
  762. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  763. o Work Queues (sched/wqueue)
  764. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  765. Title: WORK QUEUE DELAY INACCURACIES
  766. Description: Each queued work may have an optional delay value associated
  767. with it. That delay should be respect to the time that the
  768. work is queued. However, since we do not know the time the
  769. work is queue, the actual delay will be respect to the time
  770. that the work is processed. Under certain conditions, the
  771. work may sit in the queue for some time before it is
  772. processed, leading to an inaccuracy in the delay.
  773. One solution might involved saving the time when in the work
  774. structure when the work is queued. Then the delay logic can
  775. take the difference between the processing time and the
  776. queued time to get a more accurate delay.
  777. Status: Open
  778. Priority: In all known use cased, the priority is low. A problem is
  779. would only occur if the work queue is overload or if work in
  780. the work queue suspends waiting for a resource (both of which
  781. are much bigger problems).
  782. o Kernel/Protected Build
  783. ^^^^^^^^^^^^^^^^^^^^^^
  784. Title: apps/system PARTITIONING
  785. Description: Several of the USB device helper applications in apps/system
  786. violate OS/application partitioning and will fail on a kernel
  787. or protected build. Many of these have been fixed by adding
  788. the BOARDIOC_USBDEV_CONTROL boardctl() command. But there are
  789. still issues.
  790. These functions still call directly into operating system
  791. functions:
  792. - usbmsc_configure - Called from apps/system/usbmsc and
  793. apps/system/composite
  794. - usbmsc_bindlun - Called from apps/system/usbmsc
  795. - usbmsc_exportluns - Called from apps/system/usbmsc.
  796. Status: Open
  797. Priority: Medium/High -- the kernel build configuration is not fully fielded
  798. yet.
  799. Title: C++ CONSTRUCTORS HAVE TOO MANY PRIVILEGES (PROTECTED MODE)
  800. Description: When a C++ ELF module is loaded, its C++ constructors are called
  801. via sched/task_starthook.c logic. This logic runs in protected mode.
  802. The is a security hole because the user code runs with kernel-
  803. privileges when the constructor executes.
  804. Destructors likely have the opposite problem. The probably try to
  805. execute some kernel logic in user mode? Obviously this needs to
  806. be investigated further.
  807. Status: Open
  808. Priority: Low (unless you need build a secure C++ system).
  809. Title: TOO MANY SYSCALLS
  810. Description: There are a few syscalls that operate very often in user space.
  811. Since syscalls are (relatively) time consuming this could be
  812. a performance issue. Here is some numbers that I collected
  813. in an application that was doing mostly printf output:
  814. sem_post - 18% of syscalls
  815. sem_wait - 18% of syscalls
  816. getpid - 59% of syscalls
  817. --------------------------
  818. 95% of syscalls
  819. Obviously system performance could be improved greatly by simply
  820. optimizing these functions so that they do not need to system calls
  821. so frequently. This getpid() call is part of the re-entrant
  822. semaphore logic used with printf() and other C buffered I/O.
  823. Something like TLS might be used to retain the thread's ID
  824. locally.
  825. Linux, for example, has functions call up() and down(). up()
  826. increments the semaphore count but does not call into the kernel
  827. unless incrementing the count unblocks a task; similarly, down
  828. decrements the count and does not call into the kernel unless
  829. the count becomes negative the caller must be blocked.
  830. Update:
  831. "I am thinking that there should be a "magic" global, user-
  832. accessible variable that holds the PID of the currently
  833. executing thread; basically the PID of the task at the head
  834. of the ready-to-run list. This variable would have to be reset
  835. each time the head of the ready-to-run list changes.
  836. "Then getpid() could be implemented in user space with no system call
  837. by simply reading this variable.
  838. "This one would be easy: Just a change to include/nuttx/userspace.h,
  839. boards/<arch>/<chip>/<board>/kernel/up_userspace.c, libs/libc/,
  840. sched/sched_addreadytorun.c, and sched/sched_removereadytorun.c.
  841. That would eliminate 59% of the syscalls."
  842. Update:
  843. This is probably also just a symptom of the OS test that does mostly
  844. console output. The requests for the pid() are part of the
  845. implementation of the I/O's re-entrant semaphore implementation and
  846. would not be an issue in the more general case.
  847. Update:
  848. One solution might be to used CONFIG_TLS, add the PID to struct
  849. tls_info_s. Then the PID could be obtained without a system call.
  850. TLS is not very useful in the FLAT build, however. TLS works by
  851. putting per-thread data at the bottom of an aligned stack. The
  852. current stack pointer is the ANDed with the alignment mask to
  853. obtain the per-thread data address.
  854. There are problems with this in the FLAT and PROTECTED builds:
  855. First the maximum size of the stack is limited by the number
  856. of bits in the mask. This means that you need to have a very
  857. high alignment to support tasks with large stacks. But
  858. secondly, the higher the alignment of the stacks stacks, the
  859. more memory is lost to fragmentation.
  860. In the KERNEL build, the the stack lies at a virtual address
  861. and it is possible to have highly aligned stacks with no such
  862. penalties.
  863. Status: Open
  864. Priority: Low-Medium. Right now, I do not know if these syscalls are a
  865. real performance issue or not. The above statistics were collected
  866. from a an atypical application (the OS test), and does an excessive
  867. amount of console output. There is probably no issue with more typical
  868. embedded applications.
  869. Title: SECURITY ISSUES
  870. Description: In the current designed, the kernel code calls into the user-space
  871. allocators to allocate user-space memory. It is a security risk to
  872. call into user-space in kernel-mode because that could be exploited
  873. to gain control of the system. That could be fixed by dropping to
  874. user mode before trapping into the memory allocators; the memory
  875. allocators would then need to trap in order to return (this is
  876. already done to return from signal handlers; that logic could be
  877. renamed more generally and just used for a generic return trap).
  878. Another place where the system calls into the user code in kernel
  879. mode is work_usrstart() to start the user work queue. That is
  880. another security hole that should be plugged.
  881. Status: Open
  882. Priority: Low (unless security becomes an issue).
  883. Title: MICRO-KERNEL
  884. Description: The initial kernel build cut many interfaces at a very high level.
  885. The resulting monolithic kernel is then rather large. It would
  886. not be a prohibitively large task to reorganize the interfaces so
  887. that NuttX is built as a micro-kernel, i.e., with only the core
  888. OS services within the kernel and with other OS facilities, such
  889. as the file system, message queues, etc., residing in user-space
  890. and to interfacing with those core OS facilities through traps.
  891. Status: Open
  892. Priority: Low. This is a good idea and certainly an architectural
  893. improvement. However, there is no strong motivation now do
  894. do that partitioning work.
  895. Title: USER MODE TASKS CAN MODIFY PRIVILEGED TASKS
  896. Description: Certain interfaces, such as sched_setparam(),
  897. sched_setscheduler(), etc. can be used by user mode tasks to
  898. modify the behavior of privileged kernel threads.
  899. For a truly secure system. Privileges need to be checked in
  900. every interface that permits one thread to modify the
  901. properties of another thread.
  902. NOTE: It would be a simple matter to simply disable user
  903. threads from modifying privileged threads. However, you
  904. might also want to be able to modify privileged threads from
  905. user tasks with certain permissions. Permissions is a much
  906. more complex issue.
  907. task_delete(), for example, is not permitted to kill a kernel
  908. thread. But should not a privileged user task be able to do
  909. so?
  910. Status: Open
  911. Priority: Low for most embedded systems but would be a critical need if
  912. NuttX were used in a secure system.
  913. Title: ERRNO VARIABLE in KERNEL MODE
  914. Description: In the FLAT and PROTECTED mode, the errno variable is retained
  915. within the TCB. It requires a call into the OS to access the
  916. errno variable.
  917. In the KERNEL build, TLS should be used: The errno should be
  918. stored at the base of the callers stack along with other TLS
  919. data.
  920. To do this, NuttX system calls should be reorganized. The
  921. system calls should go to the internal OS functions (like
  922. nxsem_wait() vs sem_wait()) which do not set the errno value.
  923. The implementation available to applications (sem_wait() in
  924. this example) should call the internal OS function then set the
  925. errno variable in TLS.
  926. Status: Open
  927. Priority: Low, this primarily an aesthetic issue but may also have some
  928. performance implications if the the errno variable is accessed
  929. via a system call at high rates.
  930. Title: SIGNAL ACTION VULNERABILITY
  931. Description: When a signal action is peformed, the user stack is used.
  932. Unlike Linux, applications do not have separate user and
  933. supervisor stacks; everything is done on the user stack.
  934. In the implementation of up_sigdeliver(), a copy of the
  935. register contents that will be restored is present on the
  936. stack and could be modified by the user application. Thus,
  937. if the user mucks with the return stack, problems could
  938. occur when the user task returns to supervisor mode from
  939. the the signal handler.
  940. A recent commit (3 Feb 2019) does protect the status register
  941. and return address so that a malicious task cannot change the
  942. return address or switch to supervisor mode. Other register
  943. are still modifiable so there is other possible mayhem that
  944. could be done.
  945. A better solution, in lieu of a kernel stack, would be to
  946. eliminate the stack-based register save area altogether and,
  947. instead, save the registers in another, dedicated state save
  948. area in the TCB. The only hesitation to this option is that
  949. it would significantly increase the size of the TCB structure
  950. and, hence, the per-thread memory overhead.
  951. Status: Open
  952. Priority: Medium-ish if are attempting to make a secure environment that
  953. may host malicious code. Very low for the typical FLAT build,
  954. however.
  955. o C++ Support
  956. ^^^^^^^^^^^
  957. Title: USE OF SIZE_T IN NEW OPERATOR
  958. Description: The argument of the 'new' operators should take a type of
  959. size_t (see libxx/libxx_new.cxx and libxx/libxx_newa.cxx). But
  960. size_t has an unknown underlying. In the nuttx sys/types.h
  961. header file, size_t is typed as uint32_t (which is determined by
  962. architecture-specific logic). But the C++ compiler may believe
  963. that size_t is of a different type resulting in compilation errors
  964. in the operator. Using the underlying integer type Instead of
  965. size_t seems to resolve the compilation issues.
  966. Status: Kind of open. There is a workaround. Setting CONFIG_CXX_NEWLONG=y
  967. will define the operators with argument of type unsigned long;
  968. Setting CONFIG_CXX_NEWLONG=n will define the operators with argument
  969. of type unsigned int. But this is pretty ugly! A better solution
  970. would be to get a hold of the compilers definition of size_t.
  971. Priority: Low.
  972. Title: STATIC CONSTRUCTORS AND MULTITASKING
  973. Description: The logic that calls static constructors operates on the main
  974. thread of the initial user application task. Any static
  975. constructors that cache task/thread specific information such
  976. as C streams or file descriptors will not work in other tasks.
  977. See also UCLIBC++ AND STATIC CONSTRUCTORS below.
  978. Status: Open
  979. Priority: Low and probably will not changed. In these case, there will
  980. need to be an application specific solution.
  981. Title: UCLIBC++ AND STATIC CONSTRUCTORS
  982. uClibc++ was designed to work in a Unix environment with
  983. processes and with separately linked executables. Each process
  984. has its own, separate uClibc++ state. uClibc++ would be
  985. instantiated like this in Linux:
  986. 1) When the program is built, a tiny start-up function is
  987. included at the beginning of the program. Each program has
  988. its own, separate list of C++ constructors.
  989. 2) When the program is loaded into memory, space is set aside
  990. for uClibc's static objects and then this special start-up
  991. routine is called. It initializes the C library, calls all
  992. of the constructors, and calls atexit() so that the destructors
  993. will be called when the process exits.
  994. In this way, you get a per-process uClibc++ state since there
  995. is per-process storage of uClibc++ global state and per-process
  996. initialization of uClibc++ state.
  997. Compare this to how NuttX (and most embedded RTOSs) would work:
  998. 1) The entire FLASH image is built as one big blob. All of the
  999. constructors are lumped together and all called together at
  1000. one time.
  1001. This, of course, does not have to be so. We could segregate
  1002. constructors by some criteria and we could use a task start
  1003. up routine to call constructors separately. We could even
  1004. use ELF executables that are separately linked and already
  1005. have their constructors separately called when the ELF
  1006. executable starts.
  1007. But this would not do you very much good in the case of
  1008. uClibc++ because:
  1009. 2) NuttX does not support processes, i.e., separate address
  1010. environments for each task. As a result, the scope of global
  1011. data is all tasks. Any change to the global state made by
  1012. one task can effect another task. There can only one
  1013. uClibc++ state and it will be shared by all tasks. uClibc++
  1014. apparently relies on global instances (at least for cin and
  1015. cout) there is no way to have any unique state for any
  1016. "task group".
  1017. [NuttX does not support processes because in order to have
  1018. true processes, your hardware must support a memory management
  1019. unit (MMU) and I am not aware of any mainstream MCU that has
  1020. an MMU (or, at least an MMU that is capable enough to support
  1021. processes).]
  1022. NuttX does not have processes, but it does have "task groups".
  1023. See http://www.nuttx.org/doku.php?id=wiki:nxinternal:tasksnthreads.
  1024. A task group is the task plus all of the pthreads created by
  1025. the task via pthread_create(). Resources like FILE streams
  1026. are shared within a task group. Task groups are like a poor
  1027. man's process.
  1028. This means that if the uClibc++ static classes are initialized
  1029. by one member of a task group, then cin/cout should work
  1030. correctly with all threads that are members of task group. The
  1031. destructors would be called when the final member of the task
  1032. group exists (if registered via atexit()).
  1033. So if you use only pthreads, uClibc++ should work very much like
  1034. it does in Linux. If your NuttX usage model is like one process
  1035. with many threads then you have Linux compatibility.
  1036. If you wanted to have uClibc++ work across task groups, then
  1037. uClibc++ and NuttX would need some extensions. I am thinking
  1038. along the lines of the following:
  1039. 1) There is a per-task group storage are within the RTOS (see
  1040. include/nuttx/sched.h). If we add some new, non-standard APIs
  1041. then uClibc++ could get access to per-task group storage (in
  1042. the spirit of pthread_getspecific() which gives you access to
  1043. per-thread storage).
  1044. 2) Then move all of uClibc++'s global state into per-task group
  1045. storage and add a uClibc++ initialization function that would:
  1046. a) allocate per-task group storage, b) call all of the static
  1047. constructors, and c) register with atexit() to perform clean-
  1048. up when the task group exits.
  1049. That would be a fair amount of effort. I don't really know what
  1050. the scope of such an effort would be. I suspect that it is not
  1051. large but probably complex.
  1052. NOTES:
  1053. 1) See STATIC CONSTRUCTORS AND MULTITASKING
  1054. 2) To my knowledge, only some uClibc++ ofstream logic is
  1055. sensitive to this. All other statically initialized classes
  1056. seem to work OK across different task groups.
  1057. Status: Open
  1058. Priority: Low. I have no plan to change this logic now unless there is
  1059. some strong demand to do so.
  1060. o Binary loaders (binfmt/)
  1061. ^^^^^^^^^^^^^^^^^^^^^^^^
  1062. Title: NXFLAT TESTS
  1063. Description: Not all of the NXFLAT test under apps/examples/nxflat are working.
  1064. Most simply do not compile yet. tests/mutex runs okay but
  1065. outputs garbage on completion.
  1066. Update: 13-27-1, tests/mutex crashed with a memory corruption
  1067. problem the last time that I ran it.
  1068. Status: Open
  1069. Priority: High
  1070. Title: ARM UP_GETPICBASE()
  1071. Description: The ARM up_getpicbase() does not seem to work. This means
  1072. the some features like wdog's might not work in NXFLAT modules.
  1073. Status: Open
  1074. Priority: Medium-High
  1075. Title: NXFLAT READ-ONLY DATA IN RAM
  1076. Description: At present, all .rodata must be put into RAM. There is a
  1077. tentative design change that might allow .rodata to be placed
  1078. in FLASH (see Documentation/NuttXNxFlat.html).
  1079. Status: Open
  1080. Priority: Medium
  1081. Title: GOT-RELATIVE FUNCTION POINTERS
  1082. Description: If the function pointer to a statically defined function is
  1083. taken, then GCC generates a relocation that cannot be handled
  1084. by NXFLAT. There is a solution described in Documentation/NuttXNxFlat.html,
  1085. by that would require a compiler change (which we want to avoid).
  1086. The simple workaround is to make such functions global in scope.
  1087. Status: Open
  1088. Priority: Low (probably will not fix)
  1089. Title: USE A HASH INSTEAD OF A STRING IN SYMBOL TABLES
  1090. Description: In the NXFLAT symbol tables... Using a 32-bit hash value instead
  1091. of a string to identify a symbol should result in a smaller footprint.
  1092. Status: Open
  1093. Priority: Low
  1094. Title: WINDOWS-BASED TOOLCHAIN BUILD
  1095. Description: Windows build issue. Some of the configurations that use NXFLAT have
  1096. the linker script specified like this:
  1097. NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections
  1098. That will not work for windows-based tools because they require Windows
  1099. style paths. The solution is to do something like this:
  1100. if ($(WINTOOL)y)
  1101. NXFLATLDSCRIPT=${cygpath -w $(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld}
  1102. else
  1103. NXFLATLDSCRIPT=$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld
  1104. endif
  1105. Then use
  1106. NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T"$(NXFLATLDSCRIPT)" -no-check-sections
  1107. Status: Open
  1108. Priority: There are too many references like the above. They will have
  1109. to get fixed as needed for Windows native tool builds.
  1110. o Network (net/, drivers/net)
  1111. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1112. Title: LISTENING FOR UDP BROADCASTS
  1113. Description: Incoming UDP broadcast should only be accepted if listening on
  1114. INADDR_ANY(?)
  1115. Status: Open
  1116. Priority: Low
  1117. Title: CONCURRENT, UNBUFFERED TCP SEND OPERATIONS
  1118. Description: At present, there cannot be two concurrent active TCP send
  1119. operations in progress using the same socket *unless*
  1120. CONFIG_TCP_WRITE_BUFFER. This is because the uIP ACK logic
  1121. will support only one transfer at a time.
  1122. Such a situation could occur if explicit TCP send operations
  1123. are performed using the same socket (or dup's of the same)
  1124. socket on two different threads. It can also occur implicitly
  1125. when you execute more than one thread over and NSH Telenet
  1126. session.
  1127. There are two possible solutions:
  1128. 1. Remove option to build the network without write buffering
  1129. enabled. This is is simplest and perhaps the best option.
  1130. Certainly a system can be produced with a smaller RAM
  1131. footprint without write buffering. However, that probably
  1132. does not justify permitted a crippled system.
  1133. 2. Another option is to serialize the non-buffered writes for
  1134. a socket with a mutex. i.e., add a mutex to make sure that
  1135. each send that is started is able to be the exclusive
  1136. sender until all of the data to be sent has been ACKed.
  1137. That can be a very significant delay involving the send,
  1138. waiting for the ACK or a timeout and possible retransmissions!
  1139. Although it uses more memory, I believe that option 1 is the
  1140. better solution and will avoid difficult TCP bugs in the future.
  1141. Status: Open.
  1142. Priority: Medium-Low. This is only an important issue for people who
  1143. use multi-threaded, unbuffered TCP networking without a full
  1144. understanding of the issues.
  1145. Title: POLL/SELECT ON TCP/UDP SOCKETS NEEDS READ-AHEAD
  1146. Description: poll()/select() only works for availability of buffered TCP/UDP
  1147. read data (when read-ahead is enabled). The way writing is
  1148. handled in the network layer, either (1) If CONFIG_UDP/TCP_WRITE_BUFFERS=y
  1149. then we never have to wait to send; otherwise, we always have
  1150. to wait to send. So it is impossible to notify the caller
  1151. when it can send without waiting.
  1152. An exception "never having to wait" is the case where we are
  1153. out of memory for use in write buffering. In that case, the
  1154. blocking send()/sendto() would have to wait for the memory
  1155. to become available.
  1156. Status: Open, probably will not be fixed.
  1157. Priority: Medium... this does effect porting of applications that expect
  1158. different behavior from poll()/select()
  1159. Title: INTERFACES TO LEAVE/JOIN IGMP MULTICAST GROUP
  1160. Description: The interfaces used to leave/join IGMP multicast groups is non-standard.
  1161. RFC3678 (IGMPv3) suggests ioctl() commands to do this (SIOCSIPMSFILTER) but
  1162. also status that those APIs are historic. NuttX implements these ioctl
  1163. commands, but is non-standard because: (1) It does not support IGMPv3, and
  1164. (2) it looks up drivers by their device name (e.g., "eth0") vs IP address.
  1165. Linux uses setsockopt() to control multicast group membership using the
  1166. IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP options. It also looks up drivers
  1167. using IP addresses (It would require additional logic in NuttX to look up
  1168. drivers by IP address). See http://tldp.org/HOWTO/Multicast-HOWTO-6.html
  1169. Status: Open
  1170. Priority: Medium. All standards compatibility is important to NuttX. However, most
  1171. the mechanism for leaving and joining groups is hidden behind a wrapper
  1172. function so that little of this incompatibilities need be exposed.
  1173. Title: CLOSED CONNECTIONS IN THE BACKLOG
  1174. If a connection is backlogged but accept() is not called quickly, then
  1175. that connection may time out. How should this be handled? Should the
  1176. connection be removed from the backlog if it is times out or is closed?
  1177. Or should it remain in the backlog with a status indication so that accept()
  1178. can fail when it encounters the invalid connection?
  1179. Status: Open
  1180. Priority: Medium. Important on slow applications that will not accept
  1181. connections promptly.
  1182. Title: IPv6 REQUIRES ADDRESS FILTER SUPPORT
  1183. Description: IPv6 requires that the Ethernet driver support NuttX address
  1184. filter interfaces. Several Ethernet drivers do support there,
  1185. however. Others support the address filtering interfaces but
  1186. have never been verified:
  1187. C5471, LM3S, ez80, DM0x90 NIC, PIC, LPC54: Do not support
  1188. address filtering.
  1189. Kinetis, LPC17xx, LPC43xx: Untested address filter support
  1190. Status: Open
  1191. Priority: Pretty high if you want a to use IPv6 on these platforms.
  1192. Title: UDP MULTICAST RECEPTION
  1193. Description: The logic in udp_input() expects either a single receive socket or
  1194. none at all. However, multiple sockets should be capable of
  1195. receiving a UDP datagram (multicast reception). This could be
  1196. handled easily by something like:
  1197. for (conn = NULL; conn = udp_active (pbuf, conn); )
  1198. If the callback logic that receives a packet responds with an
  1199. outgoing packet, then it will over-write the received buffer,
  1200. however. recvfrom() will not do that, however. We would have
  1201. to make that the rule: Recipients of a UDP packet must treat
  1202. the packet as read-only.
  1203. Status: Open
  1204. Priority: Low, unless your logic depends on that behavior.
  1205. Title: NETWORK WON'T STAY DOWN
  1206. Description: If you enable the NSH network monitor (CONFIG_NSH_NETINIT_MONITOR)
  1207. then the NSH 'ifdown' command is broken. Doing 'nsh> ifconfig eth0'
  1208. will, indeed, bring the network down. However, the network monitor
  1209. notices the change in the link status and will bring the network
  1210. back up. There needs to be some kind of interlock between
  1211. cmd_ifdown() and the network monitor thread to prevent this.
  1212. Status: Open
  1213. Priority: Low, this is just a nuisance in most cases.
  1214. Title: FIFO CLEAN-UP AFTER CLOSING UNIX DOMAIN DATAGRAM SOCKET
  1215. Description: FIFOs are used as the IPC underlying all local Unix domain
  1216. sockets. In NuttX, FIFOs are implemented as device drivers
  1217. (not as a special FIFO files). The FIFO device driver is
  1218. instantiated when the Unix domain socket communications begin
  1219. and will automatically be released when (1) the driver is
  1220. unlinked and (2) all open references to the driver have been
  1221. closed. But there is no mechanism in place now to unlink the
  1222. FIFO when the Unix domain datagram socket is no longer used.
  1223. The primary issue is timing.. the FIFO should persist until
  1224. it is no longer needed. Perhaps there should be a delayed
  1225. call to unlink() (using a watchdog or the work queue). If
  1226. the driver is re-opened, the delayed unlink could be
  1227. canceled? Needs more thought.
  1228. NOTE: This is not an issue for Unix domain streams sockets:
  1229. The end-of-life of the FIFO is well determined when sockets
  1230. are disconnected and support for that case is fully implemented.
  1231. Status: Open
  1232. Priority: Low for now because I don't have a situation where this is a
  1233. problem for me. If you use the same Unix domain paths, then
  1234. it is not a issue; in fact it is more efficient if the FIFO
  1235. devices persist. But this would be a serious problem if,
  1236. for example, you create new Unix domain paths dynamically.
  1237. In that case you would effectively have a memory leak and the
  1238. number of FIFO instances grow.
  1239. Title: TCP IPv4-MAPPED IPv6 ADDRESSES
  1240. Description: The UDP implementation in net/udp contains support for Hybrid
  1241. dual-stack IPv6/IPv4 implementations that utilize a special
  1242. class of addresses, the IPv4-mapped IPv6 addresses. You can
  1243. see that UDP implementation in:
  1244. udp_callback.c:
  1245. ip6_map_ipv4addr(ipv4addr,
  1246. udp_send.c:
  1247. ip6_is_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr)))
  1248. ip6_is_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr))
  1249. in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr*)conn->u.ipv6.raddr);
  1250. There is no corresponding support for TCP sockets.
  1251. Status: Open
  1252. Priority: Low. I don't know of any issues now, but I am sure that
  1253. someone will encounter this in the future.
  1254. Title: MISSING netdb INTERFACES
  1255. Description: There is no implementation for many netdb interfaces such as
  1256. getnetbyname(), getprotobyname(), getnameinfo(), etc.
  1257. Status: Open
  1258. Priority: Low
  1259. Title: ETHERNET WITH MULTIPLE LPWORK THREADS
  1260. Description: Recently, Ethernet drivers were modified to support multiple
  1261. work queue structures. The question was raised: "My only
  1262. reservation would be, how would this interact in the case of
  1263. having CONFIG_STM32_ETHMAC_LPWORK and CONFIG_SCHED_LPNTHREADS
  1264. > 1? Can it be guaranteed that one work item won't be
  1265. interrupted and execution switched to another? I think so but
  1266. am not 100% confident."
  1267. I suspect that you right. There are probably vulnerabilities
  1268. in the CONFIG_STM32_ETHMAC_LPWORK with CONFIG_SCHED_LPNTHREADS
  1269. > 1 case. But that really doesn't depend entirely upon the
  1270. change to add more work queue structures. Certainly with only
  1271. work queue structure you would have concurrent Ethernet
  1272. operations in that multiple LP threads; just because the work
  1273. structure is available, does not mean that there is not dequeued
  1274. work in progress. The multiple structures probably widens the
  1275. window for that concurrency, but does not create it.
  1276. The current Ethernet designs depend upon a single work queue to
  1277. serialize data. In the case of multiple LP threads, some
  1278. additional mechanism would have to be added to enforce that
  1279. serialization.
  1280. NOTE: Most drivers will call net_lock() and net_unlock() around
  1281. the critical portions of the driver work. In that case, all work
  1282. will be properly serialized. This issue only applies to drivers
  1283. that may perform operations that require protection outside of
  1284. the net_lock'ed region. Sometimes, this may require extending
  1285. the netlock() to be beginning of the driver work function.
  1286. Status: Open
  1287. Priority: High if you happen to be using Ethernet in this configuration.
  1288. Title: NETWORK DRIVERS USING HIGH PRIORITY WORK QUEUE
  1289. Description: Many network drivers run the network on the high priority work
  1290. queue thread (or support an option to do so). Networking should
  1291. not be done on the high priority work thread because it interferes
  1292. with real-time behavior. Fix by forcing all network drivers to
  1293. run on the low priority work queue.
  1294. Status: Open
  1295. Priority: Low. Not such big deal for demo network test and demo
  1296. configurations except that it provides a bad example for a product
  1297. OS configuration.
  1298. Title: REPARTITION DRIVER FUNCTIONALITY
  1299. Description: Every network driver performs the first level of packet decoding.
  1300. It examines the packet header and calls ipv4_input(), ipv6_input().
  1301. icmp_input(), etc. as appropriate. This is a maintenance problem
  1302. because it means that any changes to the network input interfaces
  1303. affects all drivers.
  1304. A better, more maintainable solution would use a single net_input()
  1305. function that would receive all incoming packets. This function
  1306. would then perform that common packet decoding logic that is
  1307. currently implemented in every network driver.
  1308. Status: Open
  1309. Priority: Low. Really just as aesthetic maintainability issue.
  1310. Title: BROADCAST WITH MULTIPLE NETWORK INTERFACES
  1311. Description: There is currently no mechanism to send a broadcast packet
  1312. out through several network interfaces. Currently packets
  1313. can be sent to only one device. Logic in netdev_findby_ipvXaddr()
  1314. currently just selects the first device in the list of
  1315. devices; only that device will receive broadcast packets.
  1316. Status: Open
  1317. Priority: High if you require broadcast on multiple networks. There is
  1318. no simple solution known at this time, however. Perhaps
  1319. netdev_findby_ipvXaddr() should return a list of devices rather
  1320. than a single device? All upstream logic would then have to
  1321. deal with a list of devices. That would be a huge effect and
  1322. certainly doesn't dount as a "simple solution".
  1323. Title: ICMPv6 FOR 6LoWPAN
  1324. Description: The current ICMPv6 and neighbor-related logic only works with
  1325. Ethernet MAC. For 6LoWPAN, a new more conservative IPv6
  1326. neighbour discovery is provided by RFC 6775. This RFC needs to
  1327. be supported in order to support ping6 on a 6LoWPAN network.
  1328. If RFC 6775 were implemented, then arbitrary IPv6 addresses,
  1329. including addresses from DHCPv6 could be used.
  1330. UPDATE: With IPv6 neighbor discovery, any IPv6 address may
  1331. be associated with any short or extended address. In fact,
  1332. that is the whole purpose of the neighbor discover logic: It
  1333. plays the same role as ARP in IPv4; it ultimately just manages
  1334. a neighbor table that, like the arp table, provides the
  1335. mapping between IP addresses and node addresses.
  1336. The NuttX, Contiki-based 6LoWPAN implementation circumvented
  1337. the need for the neighbor discovery logic by using only MAC-
  1338. based addressing, i.e., the lower two or eight bytes of the
  1339. IP address are the node address.
  1340. Most of the 6LoWPAN compression algorithms exploit this to
  1341. compress the IPv6 address to nothing but a bit indicating
  1342. that the IP address derives from the node address. So I
  1343. think IPv6 neighbor discover is useless in the current
  1344. implementation.
  1345. If we want to use IPv6 neighbor discovery, we could dispense
  1346. with the all MAC based addressing. But if we want to retain
  1347. the more compact MAC-based addressing, then we don't need
  1348. IPv6 neighbor discovery.
  1349. So, the full neighbor discovery logic is not currently useful,
  1350. but it would still be nice to have enough in place to support
  1351. ping6. Full neighbor support would probably be necessary if we
  1352. wanted to route 6LoWPAN frames outside of the WPAN.
  1353. Status: Open
  1354. Priority: Low for now. I don't plan on implementing this. It would
  1355. only be relevant if we were to decide to abandon the use of
  1356. MAC-based addressing in the 6LoWPAN implementation.
  1357. Title: ETHERNET LOCAL BROADCAST DOES NOT WORK
  1358. Description: In case of "local broadcast" the system still send ARP
  1359. request to the destination, but it shouldn't, it should
  1360. broadcast. For Example, the system has network with IP
  1361. 10.0.0.88, netmask of 255.255.255.0, it should send
  1362. messages for 10.0.0.255 as broadcast, and not send ARP
  1363. for 10.0.0.255
  1364. For more easier networking, the next line should have give
  1365. me the broadcast address of the network, but it doesn't:
  1366. ioctl(_socket_fd, SIOCGIFBRDADDR, &bc_addr);
  1367. Status: Open
  1368. Priority: Medium
  1369. Title: TCP ISSUES WITH QUICK CLOSE
  1370. Description: This failure has been reported in the accept() logic:
  1371. - psock_tcp_accept() waits on net_lockedwait() below
  1372. - The accept operation completes, the socket is in the connected
  1373. state and psock_accept() is awakened. It cannot run,
  1374. however, because its priority is low and so it is blocked
  1375. from execution.
  1376. - In the mean time, the remote host sends a
  1377. packet which is presumably caught in the read-ahead buffer.
  1378. - Then the remote host closes the socket. Nothing happens on
  1379. the target side because net_start_monitor() has not yet been
  1380. called.
  1381. - Then accept() finally runs, but not with a connected but
  1382. rather with a disconnected socket. This fails when it
  1383. attempts to start the network monitor on the disconnected
  1384. socket below.
  1385. - It is also impossible to read the buffered TCP data from a
  1386. disconnected socket. The TCP recvfrom() logic would also
  1387. need to permit reading buffered data from a disconnected
  1388. socket.
  1389. This problem was report when the target hosted an FTP server
  1390. and files were being accessed by FileZilla.
  1391. connect() most likely has this same issue.
  1392. A work-around might be to raise the priority of the thread
  1393. that calls accept(). accept() might also need to check the
  1394. tcpstateflags in the connection structure before returning
  1395. in order to assure that the socket truly is connected.
  1396. Status: Open
  1397. Priority: Medium. I have never heard of this problem being reported
  1398. before, so I suspect it might not be so prevalent as one
  1399. might expect.
  1400. Title: LOCAL DATAGRAM RECVFROM RETURNS WRONG SENDER ADDRESS
  1401. Description: The recvfrom logic for local datagram sockets returns the
  1402. incorrect sender "from" address. Instead, it returns the
  1403. receiver's "to" address. This means that returning a reply
  1404. to the "from" address receiver sending a packet to itself.
  1405. Status: Open
  1406. Priority: Medium High. This makes using local datagram sockets in
  1407. anything but a well-known point-to-point configuration
  1408. impossible.
  1409. o USB (drivers/usbdev, drivers/usbhost)
  1410. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1411. Title: USB STORAGE DRIVER DELAYS
  1412. Description: There is a workaround for a bug in drivers/usbdev/usbdev_storage.c.
  1413. that involves delays. This needs to be redesigned to eliminate these
  1414. delays. See logic conditioned on CONFIG_USBMSC_RACEWAR.
  1415. If queuing of stall requests is supported by the DCD then this workaround
  1416. is not required. In this case, (1) the stall is not sent until all
  1417. write requests preceding the stall request are sent, (2) the stall is
  1418. sent, and then after the stall is cleared, (3) all write requests
  1419. queued after the stall are sent.
  1420. See, for example, the queuing of pending stall requests in the SAM3/4
  1421. UDP driver at arch/arm/src/sam34/sam_udp.c. There the logic is do this
  1422. is implemented with a normal request queue, a pending request queue, a
  1423. stall flag and a stall pending flag:
  1424. 1) If the normal request queue is not empty when the STALL request is
  1425. received, the stall pending flag is set.
  1426. 2) If addition write requests are received while the stall pending flag
  1427. is set (or while waiting for the stall to be sent), those write requests
  1428. go into the pending queue.
  1429. 3) When the normal request queue empties successful and all of the write
  1430. transfers complete, the STALL is sent. The stall pending flag is
  1431. cleared and the stall flag is set. Now the endpoint is really stalled.
  1432. 4) After the STALL is cleared (via the Clear Feature SETUP), the pending
  1433. request queue is copied to the normal request queue, the stall flag is
  1434. cleared, and normal write request processing resumes.
  1435. Status: Open
  1436. Priority: Medium
  1437. Title: EP0 OUT CLASS DATA
  1438. Description: There is no mechanism in place to handle EP0 OUT data transfers.
  1439. There are two aspects to this problem, neither are easy to fix
  1440. (only because of the number of drivers that would be impacted):
  1441. 1. The class drivers only send EP0 write requests and these are
  1442. only queued on EP0 IN by this drivers. There is never a read
  1443. request queued on EP0 OUT.
  1444. 2. But EP0 OUT data could be buffered in a buffer in the driver
  1445. data structure. However, there is no method currently
  1446. defined in the USB device interface to obtain the EP0 data.
  1447. Updates: (1) The USB device-to-class interface as been extended so
  1448. that EP0 OUT data can accompany the SETUP request sent to the
  1449. class drivers. (2) The logic in the STM32 F4 OTG FS device driver
  1450. has been extended to provide this data. Updates are still needed
  1451. to other drivers.
  1452. Here is an overview of the required changes:
  1453. New two buffers in driver structure:
  1454. 1. The existing EP0 setup request buffer (ctrlreq, 8 bytes)
  1455. 2. A new EP0 data buffer to driver state structure (ep0data,
  1456. max packetsize)
  1457. Add a new state:
  1458. 3. Waiting for EP0 setup OUT data (EP0STATE_SETUP_OUT)
  1459. General logic flow:
  1460. 1. When an EP0 SETUP packet is received:
  1461. - Read the request into EP0 setup request buffer (ctrlreq,
  1462. 8 bytes)
  1463. - If this is an OUT request with data length, set the EP0
  1464. state to EP0STATE_SETUP_OUT and wait to receive data on
  1465. EP0.
  1466. - Otherwise, the SETUP request may be processed now (or,
  1467. in the case of the F4 driver, at the conclusion of the
  1468. SETUP phase).
  1469. 2. When EP0 the EP0 OUT DATA packet is received:
  1470. - Verify state is EP0STATE_SETUP_OUT
  1471. - Read the request into the EP0 data buffer (ep0data, max
  1472. packet size)
  1473. - Now process the previously buffered SETUP request along
  1474. with the OUT data.
  1475. 3. When the setup packet is dispatched to the class driver,
  1476. the OUT data must be passed as the final parameter in the
  1477. call.
  1478. Update 2013-9-2: The new USB device-side driver for the SAMA5D3
  1479. correctly supports OUT SETUP data following the same design as
  1480. per above.
  1481. Update 2013-11-7: David Sidrane has fixed with issue with the
  1482. STM32 F1 USB device driver. Still a few more to go before this
  1483. can be closed out.
  1484. Status: Open
  1485. Priority: High for class drivers that need EP0 data. For example, the
  1486. CDC/ACM serial driver might need the line coding data (that
  1487. data is not used currently, but it might be).
  1488. Title: IMPROVED USAGE of STM32 USB RESOURCES
  1489. Description: The STM32 platforms use a non-standard, USB host peripheral
  1490. that uses "channels" to implement data transfers the current
  1491. logic associates each channel with an pipe/endpoint (with two
  1492. channels for bi-directional control endpoints). The OTGFS
  1493. peripheral has 8 channels and the OTGHS peripheral has 12
  1494. channels.
  1495. This works okay until you add a hub and try connect multiple
  1496. devices. A typical device will require 3-4 pipes and, hence,
  1497. 4-5 channels. This effectively prevents using a hub with the
  1498. STM32 devices. This also applies to the EFM32 which uses the
  1499. same IP.
  1500. It should be possible to redesign the STM32 F4 OTGHS/OTGFS and
  1501. EFM32 host driver so that channels are dynamically assigned to
  1502. pipes as needed for individual transfers. Then you could have
  1503. more "apparent" pipes and make better use of channels.
  1504. Although there are only 8 or 12 channels, transfers are not
  1505. active all of the time on all channels so it ought to be
  1506. possible to have an unlimited number of "pipes" but with no
  1507. more than 8 or 12 active transfers.
  1508. Status: Open
  1509. Priority: Medium-Low
  1510. Title: USB CDC/ACM HOST CLASS DRIVER
  1511. Description: A CDC/ACM host class driver has been added. This has been
  1512. testing by running the USB CDC/ACM host on an Olimex
  1513. LPC1766STK and using the
  1514. boards/arm/stm32/stm3210e-eval/configs/usbserial
  1515. configuration (using the CDC/ACM device side driver). There
  1516. are several unresolved issues that prevent the host driver
  1517. from being usable:
  1518. - The driver works fine when configured for reduced or bulk-
  1519. only protocol on the Olimex LPC1766STK.
  1520. - Testing has not been performed with the interrupt IN channel
  1521. enabled (ie., I have not enabled FLOW control nor do I have
  1522. a test case that used the interrupt IN channel). I can see
  1523. that the polling for interrupt IN data is occurring
  1524. initially.
  1525. - I test for incoming data by doing 'nsh> cat /dev/ttyACM0' on
  1526. the Olimex LPC1766STK host. The bulk data reception still
  1527. works okay whether or not the interrupt IN channel is enabled.
  1528. If the interrupt IN channel is enabled, then polling of that
  1529. channel appears to stop when the bulk in channel becomes
  1530. active.
  1531. - The RX reception logic uses the low priority work queue.
  1532. However, that logic never returns and so blocks other use of
  1533. the work queue thread. This is probably okay but means that
  1534. the RX reception logic probably should be moved to its own
  1535. dedicated thread.
  1536. - I get crashes when I run with the STM32 OTGHS host driver.
  1537. Apparently the host driver is trashing memory on receipt
  1538. of data.
  1539. UPDATE: This behavior needs to be retested with:
  1540. commit ce2845c5c3c257d081f624857949a6afd4a4668a
  1541. Author: Janne Rosberg <janne.rosberg@offcode.fi>
  1542. Date: Tue Mar 7 06:58:32 2017 -0600
  1543. usbhost_cdcacm: fix tx outbuffer overflow and remove now
  1544. invalid assert
  1545. commit 3331e9c49aaaa6dcc3aefa6a9e2c80422ffedcd3
  1546. Author: Janne Rosberg <janne.rosberg@offcode.fi>
  1547. Date: Tue Mar 7 06:57:06 2017 -0600
  1548. STM32 OTGHS host: stm32_in_transfer() fails and returns NAK
  1549. if a short transfer is received. This causes problems from
  1550. class drivers like CDC/ACM where short packets are expected.
  1551. In those protocols, any transfer may be terminated by sending
  1552. short or NUL packet.
  1553. commit 0631c1aafa76dbaa41b4c37e18db98be47b60481
  1554. Author: Gregory Nutt <gnutt@nuttx.org>
  1555. Date: Tue Mar 7 07:17:24 2017 -0600
  1556. STM32 OTGFS, STM32 L4 and F7: Adapt Janne Rosberg's patch to
  1557. STM32 OTGHS host to OTGFS host, and to similar implements for
  1558. L4 and F7.
  1559. - The SAMA5D EHCI and the LPC31 EHCI drivers both take semaphores
  1560. in the cancel method. The current CDC/ACM class driver calls
  1561. the cancel() method from an interrupt handler. This will
  1562. cause a crash. Those EHCI drivers should be redesigned to
  1563. permit cancellation from the interrupt level.
  1564. Most of these problems are unique to the Olimex LPC1766STK
  1565. DCD; some are probably design problems in the CDC/ACM host
  1566. driver. The bottom line is that the host CDC/ACM driver is
  1567. still immature and you could experience issues in some
  1568. configurations if you use it.
  1569. That all being said, I know of no issues with the current
  1570. CDC/ACM driver on the Olimex LPC1766STK platform if the interrupt
  1571. IN endpoint is not used, i.e., in "reduced" mode. The only loss
  1572. of functionality is output flow control.
  1573. UPDATE: The CDC/ACM class driver may also now be functional on
  1574. the STM32. That needs to be verified.
  1575. Status: Open
  1576. Priority: Medium-Low unless you really need host CDC/ACM support.
  1577. o Libraries (libs/libc/, libs/libm/)
  1578. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1579. Title: SIGNED time_t
  1580. Description: The NuttX time_t is type uint32_t. I think this is consistent
  1581. with all standards and with normal usage of time_t. However,
  1582. according to Wikipedia, time_t is usually implemented as a
  1583. signed 32-bit value.
  1584. Status: Open
  1585. Priority: Very low unless there is some compelling issue that I do not
  1586. know about.
  1587. Title: ENVIRON
  1588. Description: The definition of environ in stdlib.h is bogus and will not
  1589. work as it should. This is because the underlying
  1590. representation of the environment is not an array of pointers.
  1591. Status: Open
  1592. Priority: Medium
  1593. Title: TERMIOS
  1594. Description: Need some minimal termios support... at a minimum, enough to
  1595. switch between raw and "normal" modes to support behavior like
  1596. that needed for readline().
  1597. UPDATE: There is growing functionality in libs/libc/termios/
  1598. and in the ioctl methods of several MCU serial drivers (stm32,
  1599. lpc43, lpc17, pic32, and others). However, as phrased, this
  1600. bug cannot yet be closed since this "growing functionality"
  1601. does not address all termios.h functionality and not all
  1602. serial drivers support termios.
  1603. Status: Open
  1604. Priority: Low
  1605. Title: CONCURRENT STREAM READ/WRITE
  1606. Description: NuttX only supports a single file pointer so reads and writes
  1607. must be from the same position. This prohibits implementation
  1608. of behavior like that required for fopen() with the "a+" mode.
  1609. According to the fopen man page:
  1610. "a+ Open for reading and appending (writing at end of file).
  1611. The file is created if it does not exist. The initial file
  1612. position for reading is at the beginning of the file, but
  1613. output is always appended to the end of the file."
  1614. At present, the single NuttX file pointer is positioned to the
  1615. end of the file for both reading and writing.
  1616. Status: Open
  1617. Priority: Medium. This kind of operation is probably not very common in
  1618. deeply embedded systems but is required by standards.
  1619. Title: DIVIDE BY ZERO
  1620. Description: This is bug 3468949 on the SourceForge website (submitted by
  1621. Philipp Klaus Krause):
  1622. "lib_strtod.c does contain divisions by zero in lines 70 and 96.
  1623. AFAIK, unlike for Java, division by zero is not a reliable way to
  1624. get infinity in C. AFAIK compilers are allowed e.g. give a compile-
  1625. time error, and some, such as sdcc, do. AFAIK, C implementations
  1626. are not even required to support infinity. In C99 the macro isinf()
  1627. could replace the first use of division by zero. Unfortunately, the
  1628. macro INFINITY from math.h probably can't replace the second division
  1629. by zero, since it will result in a compile-time diagnostic, if the
  1630. implementation does not support infinity."
  1631. Status: Open
  1632. Priority:
  1633. Title: OLD dtoa NEEDS TO BE UPDATED
  1634. Description: This implementation of dtoa in libs/libc/stdio is old and will not
  1635. work with some newer compilers. See
  1636. http://patrakov.blogspot.com/2009/03/dont-use-old-dtoac.html
  1637. Update: A new dtoa version is not available and enabled with
  1638. CONFIG_NANO_PRINF. However, the old version of dtoa is still in
  1639. in place and lib_libvsprintf() has been dupliated. I think this
  1640. issue should remain open until the implementations have been
  1641. unified.
  1642. Status: Open
  1643. Priority: ??
  1644. Title: FLOATING POINT FORMATS
  1645. Description: Only the %f floating point format is supported. Others are
  1646. accepted but treated like %f.
  1647. Update: %g is supported with CONFIG_NANO_PRINTF.
  1648. Status: Open
  1649. Priority: Medium (this might important to someone).
  1650. Title: LIBM INACCURACIES
  1651. Description: "..if you are writing something like robot control or
  1652. inertial navigation system for aircraft, I have found
  1653. that using the toolchain libmath is only safe option.
  1654. I ported some code for converting quaternions to Euler
  1655. angles to NuttX for my project and only got it working
  1656. after switching to newlib math library.
  1657. "NuttX does not fully implement IEC 60559 floating point
  1658. from C99 (sections marked [MX] in OpenGroup specs) so if
  1659. your code assumes that some function, say pow(), actually
  1660. behaves right for all the twenty or so odd corner cases
  1661. that the standards committees have recently specified,
  1662. you might get surprises. I'd expect pow(0.0, 1.0) to
  1663. return 0.0 (as zero raised to any positive power is
  1664. well-defined in mathematics) but I get +Inf.
  1665. "NuttX atan2(-0.0, -1.0) returns +M_PI instead of correct
  1666. -M_PI. If we expect [MX] functionality, then atan2(Inf, Inf)
  1667. should return M_PI/4, instead NuttX gives NaN.
  1668. "asin(2.0) does not set domain error or return NaN. In fact
  1669. it does not return at all as the loop in it does not
  1670. converge, hanging your app.
  1671. "There are likely many other issues like these as the Rhombus
  1672. OS code has not been tested or used that much. Sorry for not
  1673. providing patches, but we found it easier just to switch the
  1674. math library."
  1675. UPDATE: 2015-09-01: A fix for the noted problems with asin()
  1676. has been applied.
  1677. 2016-07-30: Numerous fixes and performance improvements from
  1678. David Alessio.
  1679. Status: Open
  1680. Priority: Low for casual users but clearly high if you need care about
  1681. these incorrect corner case behaviors in the math libraries.
  1682. Title: REPARTITION LIBC FUNCTIONALITY
  1683. Description: There are many things implemented within the kernel (for example
  1684. under sched/pthread) that probably should be migrated in the
  1685. C library where it belongs.
  1686. I would really like to see a little flavor of a micro-kernel
  1687. at the OS interface: I would like to see more primitive OS
  1688. system calls with more higher level logic in the C library.
  1689. One awkward thing is the incompatibility of KERNEL vs FLAT
  1690. builds: In the kernel build, it would be nice to move many
  1691. of the thread-specific data items out of the TCB and into
  1692. the process address environment where they belong. It is
  1693. difficult to make this compatible with the FLAT build,
  1694. however.
  1695. Status: Open
  1696. Priority: Low
  1697. o File system / Generic drivers (fs/, drivers/)
  1698. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1699. NOTE: The NXFFS file system has its own TODO list at nuttx/fs/nxffs/README.txt
  1700. Title: MISSING FILE SYSTEM FEATURES
  1701. Description: Implement missing file system features:
  1702. chmod() is probably not relevant since file modes are not
  1703. currently supported.
  1704. File privileges would also be good to support. But this is
  1705. really a small part of a much larger feature. NuttX has no
  1706. user IDs, there are no groups, there are no privileges
  1707. associated with either. User's don't need credentials.
  1708. This is really a system wide issues of which chmod is only
  1709. a small part.
  1710. User privileges never seemed important to me since NuttX is
  1711. intended for deeply embedded environments where there are
  1712. not multiple users with varying levels of trust.
  1713. link, unlink, softlink, readlink - For symbolic links. Only
  1714. the ROMFS file system currently supports hard and soft links,
  1715. so this is not too important. The top-level, pseudo-file
  1716. system supports soft links.
  1717. File locking
  1718. Special files - NuttX support special files only in the top-
  1719. level pseudo file system. Unix systems support many
  1720. different special files via mknod(). This would be
  1721. important only if it is an objective of NuttX to become a
  1722. true Unix OS. Again only supported by ROMFS.
  1723. True inodes - Standard Unix inodes. Currently only supported
  1724. by ROMFs.
  1725. File times, for example as set by utimes().
  1726. The primary obstacle to all these is that each would require
  1727. changes to all existing file systems. That number is pretty
  1728. large. The number of file system implementations that would
  1729. need to be reviewed and modified As of this writing this
  1730. would include binfs, fat, hostfs, nfs, nxffs, procfs, romfs,
  1731. tmpfs, unionfs, plus pseduo-file system support.
  1732. Status: Open
  1733. Priority: Low
  1734. Title: ROMFS CHECKSUMS
  1735. Description: The ROMFS file system does not verify checksums on either
  1736. volume header on on the individual files.
  1737. Status: Open
  1738. Priority: Low. I have mixed feelings about if NuttX should pay a
  1739. performance penalty for better data integrity.
  1740. Title: SPI-BASED SD MULTIPLE BLOCK TRANSFERS
  1741. Description: The simple SPI based MMCS/SD driver in fs/mmcsd does not
  1742. yet handle multiple block transfers.
  1743. Status: Open
  1744. Priority: Medium-Low
  1745. Title: SDIO-BASED SD READ-AHEAD/WRITE BUFFERING INCOMPLETE
  1746. Description: The drivers/mmcsd/mmcsd_sdio.c driver has hooks in place to
  1747. support read-ahead buffering and write buffering, but the logic
  1748. is incomplete and untested.
  1749. Status: Open
  1750. Priority: Low
  1751. Title: POLLHUP SUPPORT
  1752. Description: All drivers that support the poll method should also report
  1753. POLLHUP event when the driver is closed.
  1754. Status: Open
  1755. Priority: Medium-Low
  1756. Title: CONFIG_RAMLOG_CONSOLE DOES NOT WORK
  1757. Description: When I enable CONFIG_RAMLOG_CONSOLE, the system does not come up
  1758. properly (using configuration stm3240g-eval/nsh2). The problem
  1759. may be an assertion that is occurring before we have a console.
  1760. Status: Open
  1761. Priority: Medium
  1762. Title: UNIFIED DESCRIPTOR REPRESENTATION
  1763. Description: There are two separate ranges of descriptors for file and
  1764. socket descriptors: if a descriptor is in one range then it is
  1765. recognized as a file descriptor; if it is in another range
  1766. then it is recognized as a socket descriptor. These separate
  1767. descriptor ranges can cause problems, for example, they make
  1768. dup'ing descriptors with dup2() problematic. The two groups
  1769. of descriptors are really indices into two separate tables:
  1770. On an array of file structures and the other an array of
  1771. socket structures. There really should be one array that
  1772. is a union of file and socket descriptors. Then socket and
  1773. file descriptors could lie in the same range.
  1774. Another example of how the current implementation limits
  1775. functionality: I recently started to implement of the FILEMAX
  1776. (using pctl() instead sysctl()). My objective was to be able
  1777. to control the number of available file descriptors on a task-
  1778. by-task basis. The complexity due to the partitioning of
  1779. descriptor space into a range for file descriptors and a range
  1780. for socket descriptors made this feature nearly impossible to
  1781. implement.
  1782. Status: Open
  1783. Priority: Low
  1784. Title: DUPLICATE FAT FILE NAMES
  1785. Description: "The NSH and POSIX API interpretations about sensitivity or
  1786. insensitivity to upper/lowercase file names seem to be not
  1787. consistent in our usage - which can result in creating two
  1788. directories with the same name..."
  1789. Example using NSH:
  1790. nsh> echo "Test1" >/tmp/AtEsT.tXt
  1791. nsh> echo "Test2" >/tmp/aTeSt.TxT
  1792. nsh> ls /tmp
  1793. /tmp:
  1794. AtEsT.tXt
  1795. aTeSt.TxT
  1796. nsh> cat /tmp/aTeSt.TxT
  1797. Test2
  1798. nsh> cat /tmp/AtEsT.tXt
  1799. Test1
  1800. Status: Open
  1801. Priority: Low
  1802. Title: MISSING FILES IN NSH 'LS' OF A DIRECTORY
  1803. Description: I have seen cases where (1) long file names are enabled,
  1804. but (2) a short file name is created like:
  1805. nsh> echo "This is another test" >/mnt/sdcard/another.txt
  1806. But then on subsequent 'ls' operations, the file does not appear:
  1807. nsh> ls -l /mnt/sdcard
  1808. I have determined that the problem is because, for some as-
  1809. of-yet-unknown reason the short file name is treated as a long
  1810. file name. The name then fails the long filename checksum
  1811. test and is skipped.
  1812. readdir() (and fat_readdir()) is the logic underlying the
  1813. failure and the problem appears to be something unique to the
  1814. fat_readdir() implementation. Why? Because the file is
  1815. visible when you put the SD card on a PC and because this
  1816. works fine:
  1817. nsh> ls -l /mnt/sdcard/another.txt
  1818. The failure does not happen on all short file names. I do
  1819. not understand the pattern. But I have not had the opportunity
  1820. to dig into this deeply.
  1821. Status: Open
  1822. Priority: Perhaps not a problem??? I have analyzed this problem and
  1823. I am not sure what to do about it. I am suspected that a
  1824. fat filesystem was used with a version of NuttX that does
  1825. not support long file name entries. Here is the failure
  1826. scenario:
  1827. 1) A file with a long file name is created under Windows.
  1828. 2) Then the file is deleted. I am not sure if Windows or
  1829. NuttX deleted the file, but the resulting directory
  1830. content is not compatible with NuttX with long file
  1831. name support.
  1832. The file deletion left the full sequence of long
  1833. file name entries intact but apparently delete only
  1834. the following short file name entry. I am thinking
  1835. that this might have happened because a version of NuttX
  1836. with only short file name support was used to delete
  1837. the file.
  1838. 3) When a new file with a short file name was created, it
  1839. re-used the short file name entry that was previously
  1840. deleted. This makes the new short file name entry
  1841. look like a part of the long file name.
  1842. 4) When comparing the checksum in the long file name
  1843. entry with the checksum of the short file name, the
  1844. checksum fails and the entire directory sequence is
  1845. ignored by readdir() logic. This is why the file does
  1846. not appear in the 'ls'.
  1847. Title: SILENT SPIFFS FILE TRUNCATION
  1848. Description: Under certain corner case conditions, SPIFFS will truncate
  1849. files. All of the writes to the file will claim that the
  1850. data has been written but after the file is closed, it may
  1851. be a little shorter than expected.
  1852. This is due to how the caching is implemented in SPIFFS:
  1853. 1. On each write, the data is not written to the FLASH but
  1854. rather to an internal cache in memory.
  1855. 2. When the a write causes the cache to become full, the
  1856. content of cache is flushed to memory. If that flush
  1857. fails because the FLASH has become full, write will
  1858. return the file system full error (ENOSPC).
  1859. 3. The cache is also flushed when the file is closed (or
  1860. when fsync() is called). These will also fail if the
  1861. file system becomes full.
  1862. The problem is when the file is closed, the final file
  1863. size could be smaller than the number of successful writes
  1864. to the file.
  1865. This error is probably not so significant in a real world
  1866. file system usage: It requires that you write continuously
  1867. to SPIFFS, never deleting files or freeing FLASH resources
  1868. in any way. And it requires the unlikely circumstance that
  1869. the final file written has its last few hundred bytes in
  1870. cache when the file is closed but there are even fewer bytes
  1871. available on the FLASH. That would be rare with a cache
  1872. size of a few hundred bytes and very large serial FLASH.
  1873. This issue does cause the test at apps/testing/fstest to
  1874. fail. That test fails with a "Partial Read" because the
  1875. file being read is smaller than number bytes written to the
  1876. file. That test does write small files continuously until
  1877. file system is full and even the the error is rare. The
  1878. boards/sim/sim/sim/configs/spiffs test can used to
  1879. demonstrate the error.
  1880. Status: Open
  1881. Priority: Medium. It is certain a file system failure, but I think that
  1882. the exposure in real world uses cases is very small.
  1883. Title: FAT: CAN'T SEEK TO END OF FILE IF READ-ONLY
  1884. Description: If the size of the underlying file is an exact multiple of the
  1885. FAT cluster size, then you cannot seek to the end of the file
  1886. if the file was opened read-only. In that case, the FAT lseek
  1887. logic will return ENOSPC.
  1888. This is because seeking to the end of the file involves seeking
  1889. to an offset that is the size of the file (number of bytes
  1890. allocated for file + 1). In order to seek to a position, the
  1891. current FAT implementation insists that there be allocated file
  1892. space at the seek position. Seeking beyond the end of the file
  1893. has the side effect of extending the file.
  1894. [NOTE: This automatic extension of the file cluster allocation
  1895. is probably unnecessary and another issue of its own.]
  1896. For example, suppose you have a cluster size that is 4096 bytes
  1897. and a file that is 8192 bytes long. Then the file will consist
  1898. of 2 allocated clusters at offsets 0 through 8191.
  1899. If the file is opened O_RDWR or O_WRONLY, then the statement:
  1900. offset = lseek(fd, 0, SET_SEEK);
  1901. will seek to offset 8192 which beyond the end of the file so a
  1902. new (empty) cluster will be added. Now the file consists of
  1903. three clusters and the file position refers to the first byte of
  1904. the third cluster.
  1905. If the file is open O_RDONLY, however, then that same lseek
  1906. statement will fail. It is not possible to seek to position
  1907. 8192. That is beyond the end of the allocated cluster chain
  1908. and since the file is read-only, it is not permitted to extend
  1909. the cluster chain. Hence, the error ENOSPC is returned.
  1910. This code snippet will duplicate the problem. It assumes a
  1911. cluster size of 512 and that /tmp is a mounted FAT file system:
  1912. #define BUFSIZE 1024 //8192, depends on cluster size
  1913. static char buffer[BUFSIZE];
  1914. #if defined(BUILD_MODULE)
  1915. int main(int argc, FAR char *argv[])
  1916. #else
  1917. int hello_main(int argc, char *argv[])
  1918. #endif
  1919. {
  1920. ssize_t nwritten;
  1921. off_t pos;
  1922. int fd;
  1923. int ch;
  1924. int i;
  1925. for (i = 0, ch = ' '; i < BUFSIZE; i++)
  1926. {
  1927. buffer[i] = ch;
  1928. if (++ch == 0x7f)
  1929. {
  1930. ch = ' ';
  1931. }
  1932. }
  1933. fd = open("/tmp/testfile", O_WRONLY | O_CREAT | O_TRUNC, 0644);
  1934. if (fd < 0)
  1935. {
  1936. printf("open failed: %d\n", errno);
  1937. return 1;
  1938. }
  1939. nwritten = write(fd, buffer, BUFSIZE);
  1940. if (nwritten < 0)
  1941. {
  1942. printf("write failed: %d\n", errno);
  1943. return 1;
  1944. }
  1945. close(fd);
  1946. fd = open("/tmp/testfile", O_RDONLY);
  1947. if (fd < 0)
  1948. {
  1949. printf("open failed: %d\n", errno);
  1950. return 1;
  1951. }
  1952. pos = lseek(fd, 0, SEEK_END);
  1953. if (pos < 0)
  1954. {
  1955. printf("lseek failed: %d\n", errno);
  1956. return 1;
  1957. }
  1958. else if (pos != BUFSIZE)
  1959. {
  1960. printf("lseek failed: %d\n", pos);
  1961. return 1;
  1962. }
  1963. close(fd);
  1964. return 0;
  1965. }
  1966. Status: Open
  1967. Priority: Medium. Although this is a significant design error, the problem
  1968. has existed for 11 years without being previously reported. I
  1969. conclude, then that the exposure from this problem is not great.
  1970. Why would you seek to the end of a file using a read=only file
  1971. descriptor anyway? Only one reason I can think of: To get the
  1972. size of the file. The alternative (and much more efficient) way
  1973. to do that is via stat().
  1974. o Graphics Subsystem (graphics/)
  1975. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  1976. See also the NxWidgets TODO list file for related issues.
  1977. Title: UNTESTED GRAPHICS APIS
  1978. Description: Testing of all APIs is not complete. See
  1979. http://nuttx.sourceforge.net/NXGraphicsSubsystem.html#testcoverage
  1980. Status: Open
  1981. Priority: Medium
  1982. Title: ITALIC FONTS / NEGATIVE FONT OFFSETS
  1983. Description: Font metric structure (in include/nuttx/nx/nxfont.h) should allow
  1984. negative X offsets. Negative x-offsets are necessary for certain
  1985. glyphs (and is very common in italic fonts).
  1986. For example Eth, icircumflex, idieresis, and oslash should have
  1987. offset=1 in the 40x49b font (these missing negative offsets are
  1988. NOTE'ed in the font header files).
  1989. Status: Open. The problem is that the x-offset is an unsigned bitfield
  1990. in the current structure.
  1991. Priority: Low.
  1992. Title: RAW WINDOW AUTORAISE
  1993. Description: Auto-raise only applies to NXTK windows. Shouldn't it also apply
  1994. to raw windows as well?
  1995. Status: Open
  1996. Priority: Low
  1997. Title: AUTO-RAISE DISABLED
  1998. Description: Auto-raise is currently disabled. The reason is complex:
  1999. - Most touchscreen controls send touch data a high rates
  2000. - In multi-server mode, touch events get queued in a message
  2001. queue.
  2002. - The logic that receives the messages performs the auto-raise.
  2003. But it can do stupid things after the first auto-raise as
  2004. it operates on the stale data in the message queue.
  2005. I am thinking that auto-raise ought to be removed from NuttX
  2006. and moved out into a graphics layer (like NxWM) that knows
  2007. more about the appropriate context to do the autoraise.
  2008. Status: Open
  2009. Priority: Medium low
  2010. Title: NxTERM VT100 SUPPORT
  2011. Description: If the NxTerm will be used with the Emacs-like command line
  2012. editor (CLE), then it will need to support VT100 cursor control
  2013. commands.
  2014. Status: Open
  2015. Priority: Low, the need has not yet arisen.
  2016. Title: VERTICAL ANTI-ALIASING
  2017. Description: Anti-aliasing is implemented along the horizontal raster line
  2018. with fractional pixels at the ends of each line. There is no
  2019. accounting for fractional pixels in the vertical direction.
  2020. As a result lines closer to vertical receive better anti-
  2021. aliasing than lines closer to horizontal.
  2022. Status: Open
  2023. Priority: Low, not a serious issue but worth noting. There is no plan
  2024. to change this behavior.
  2025. Title: WIDE-FONT SUPPORT
  2026. Description: Wide fonts are not currently supported by the NuttX graphics sub-
  2027. system.
  2028. Status: Open
  2029. Priority: Low for many, but I imagine higher in countries that use wide fonts
  2030. Title: LOW-RES FRAMEBUFFER RENDERING
  2031. Description: There are obvious issues in the low-res, < 8 BPP, implementation of
  2032. the framebuffer rendering logic of graphics/nxglib/fb. I see two
  2033. obvious problems in reviewing nxglib_copyrectangle():
  2034. 1. The masking logic might work 1 BPP, but is insufficient for other
  2035. resolutions like 2-BPP and 4-BPP.
  2036. 2. The use of lnlen will not handle multiple bits per pixel. It
  2037. would need to be converted to a byte count.
  2038. The function PDC_copy_glyph() in the file apps/graphics/pdcurs34/nuttx/pdcdisp.c
  2039. derives from nxglib_copyrectangle() and all of those issues have been
  2040. resolved in that file.
  2041. Other framebuffer rendering functions probably have similar issues.
  2042. Status: Open
  2043. Priority: Low. It is not surprising that there would be bugs in this logic:
  2044. I have never encountered a hardware framebuffer with sub-byte pixel
  2045. depth. If such a beast ever shows up, then this priority would be
  2046. higher.
  2047. Title: INCOMPLATE PLANAR COLOR SUPPORT
  2048. Description: The original NX design included support for planar colors,
  2049. i.e,. for devices that provide separate framebuffers for each
  2050. color component. Planar graphics hard was common some years
  2051. back but is rarely encountered today. In fact, I am not aware
  2052. of any MCU that implements planar framebuffers.
  2053. Support for planar colors is, however, unverified and
  2054. incomplete. In fact, many recent changes explicitly assume a
  2055. single color plane: Planar colors are specified by a array
  2056. of components; some recent logic uses only component [0],
  2057. ignoring the possible existence of other color componet frames.
  2058. Completely removing planar color support is one reasonable
  2059. options; it is not likely that NuttX will encounter planar
  2060. color hardware and this would greatly simplify the logic and
  2061. eliminate inconsistencies in the immplementation.
  2062. Status: Open
  2063. Priority: Low. There is no problem other than one of aesthetics.
  2064. o Build system
  2065. ^^^^^^^^^^^^
  2066. Title: MAKE EXPORT LIMITATIONS
  2067. Description: The top-level Makefile 'export' target that will bundle up all of the
  2068. NuttX libraries, header files, and the startup object into an export-able
  2069. tarball. This target uses the tools/mkexport.sh script. Issues:
  2070. 1. This script assumes the host archiver ar may not be appropriate for
  2071. non-GCC toolchains
  2072. 2. For the kernel build, the user libraries should be built into some
  2073. libuser.a. The list of user libraries would have to accepted with
  2074. some new argument, perhaps -u.
  2075. Status: Open
  2076. Priority: Low.
  2077. o Other drivers (drivers/)
  2078. ^^^^^^^^^^^^^^^^^^^^^^^^
  2079. Title: SYSLOG OUTPUT LOST ON A CRASH
  2080. Description: Flush syslog output on crash. I don't know how to do in the
  2081. character driver case with interrupts disabled. It would be
  2082. easy to flush the interrupt interrupt buffer, but not the
  2083. data buffered within a character driver (such as the serial
  2084. driver).
  2085. Perhaps there could be a crash dump IOCTL command to flush
  2086. that buffered data with interrupts disabled?
  2087. Status: Open
  2088. Priority: Low. It would be a convenience and would simplify crash
  2089. debug if you could see all of the SYSLOG output up to the
  2090. time of the crash. But not essential.
  2091. Title: SERIAL DRIVER WITH DMA DOES NOT DISCARD OOB CHARACTERS
  2092. Description: If Ctrl-Z or Ctrl-C actions are enabled, the the OOB
  2093. character that generates the signal action must not be placed
  2094. in the serial driver Rx buffer. This behavior is correct for
  2095. the non-DMA case (serial_io.c), but not for the DMA case
  2096. (serial_dma.c). In the DMA case, the OOB character is left
  2097. in the Rx buffer and will be received as normal Rx data by
  2098. the application. It should not work that way.
  2099. Perhaps in the DMA case, the OOB characters could be filtered
  2100. out later, just before returning the Rx data to the application?
  2101. Status: Open
  2102. Priority: Low, provided that the application can handle these characters
  2103. in the data stream.
  2104. o Linux/Cywgin simulation (arch/sim)
  2105. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2106. Title: SIMULATOR HAS NO INTERRUPTS (NON-PREMPTIBLE)
  2107. Description: The current simulator implementation is has no interrupts and, hence,
  2108. is non-preemptible. Also, without simulated interrupt, there can
  2109. be no high-fidelity simulated device drivers.
  2110. Currently, all timing and serial input is simulated in the IDLE loop:
  2111. When nothing is going on in the simulation, the IDLE loop runs and
  2112. fakes timer and UART events.
  2113. Status: Open
  2114. Priority: Low, unless there is a need for developing a higher fidelity simulation
  2115. I have been thinking about how to implement simulated interrupts in
  2116. the simulation. I think a solution would work like this:
  2117. http://www.nuttx.org/doku.php?id=wiki:nxinternal:simulator
  2118. Title: ROUND-ROBIN SCHEDULING IN THE SIMULATOR
  2119. Description: Since the simulation is not pre-emptible, you can't use round-robin
  2120. scheduling (no time slicing). Currently, the timer interrupts are
  2121. "faked" during IDLE loop processing and, as a result, there is no
  2122. task pre-emption because there are no asynchronous events. This could
  2123. probably be fixed if the "timer interrupt" were driver by Linux
  2124. signals. NOTE: You would also have to implement up_irq_save() and
  2125. up_irq_restore() to block and (conditionally) unblock the signal.
  2126. Status: Open
  2127. Priority: Low
  2128. Title: SMP SIMULATION ISSUES
  2129. Description: The configuration has basic support SMP testing. The simulation
  2130. supports the emulation of multiple CPUs by creating multiple
  2131. pthreads, each run a copy of the simulation in the same process
  2132. address space.
  2133. At present, the SMP simulation is not fully functional: It does
  2134. operate on the simulated CPU threads for a few context switches
  2135. then fails during a setjmp() operation. I suspect that this is
  2136. not an issue with the NuttX SMP logic but more likely some chaos
  2137. in the pthread controls. I have seen similar such strange behavior
  2138. other times that I have tried to use setjmp/longmp from a signal
  2139. handler! Like when I tried to implement simulated interrupts
  2140. using signals.
  2141. Apparently, if longjmp is invoked from the context of a signal
  2142. handler, the result is undefined:
  2143. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1318.htm
  2144. You can enable SMP for ostest configuration by enabling:
  2145. -# CONFIG_EXPERIMENTAL is not set
  2146. +CONFIG_EXPERIMENTAL=y
  2147. +CONFIG_SPINLOCK=y
  2148. +CONFIG_SMP=y
  2149. +CONFIG_SMP_NCPUS=2
  2150. +CONFIG_SMP_IDLETHREAD_STACKSIZE=2048
  2151. You also must enable near-realtime-performance otherwise even long
  2152. timeouts will expire before a CPU thread even has a chance to
  2153. execute.
  2154. -# CONFIG_SIM_WALLTIME is not set
  2155. +CONFIG_SIM_WALLTIME=y
  2156. And you can enable some additional debug output with:
  2157. -# CONFIG_DEBUG_SCHED is not set
  2158. +CONFIG_DEBUG_SCHED=y
  2159. -# CONFIG_SCHED_INSTRUMENTATION is not set
  2160. +CONFIG_SCHED_INSTRUMENTATION=y
  2161. The NSH configuration can also be forced to run SMP, but
  2162. suffers from the same quirky behavior. I can be made
  2163. reliable if you modify arch/sim/src/up_idle.c so that
  2164. the IDLE loop only runs for CPU0. Otherwise, often
  2165. simuart_post() will be called from CPU1 and it will try
  2166. to restart NSH on CPU0 and, again, the same quirkiness
  2167. occurs.
  2168. But for example, this command:
  2169. nsh> sleep 1 &
  2170. will execute the sleep command on CPU1 which has worked
  2171. every time that I have tried it (which is not too many
  2172. times).
  2173. Status: Open
  2174. Priority: Low, SMP is important, but SMP on the simulator is not
  2175. o ARM (arch/arm/)
  2176. ^^^^^^^^^^^^^^^
  2177. Title: IMPROVED ARM INTERRUPT HANDLING
  2178. Description: ARM interrupt handling performance could be improved in some
  2179. ways. One easy way is to use a pointer to the context save
  2180. area in g_current_regs instead of using up_copystate so much.
  2181. This approach is already implemented for the ARM Cortex-M0,
  2182. Cortex-M3, Cortex-M4, and Cortex-A5 families. But still needs
  2183. to be back-ported to the ARM7 and ARM9 (which are nearly
  2184. identical to the Cortex-A5 in this regard). The change is
  2185. *very* simple for this architecture, but not implemented.
  2186. Status: Open. But complete on all ARM platforms except ARM7 and ARM9.
  2187. Priority: Low.
  2188. Title: IMPROVED ARM INTERRUPT HANDLING
  2189. Description: The ARM and Cortex-M3 interrupt handlers restores all registers
  2190. upon return. This could be improved as well: If there is no
  2191. context switch, then the static registers need not be restored
  2192. because they will not be modified by the called C code.
  2193. (see arch/renesas/src/sh1/sh1_vector.S for example)
  2194. Status: Open
  2195. Priority: Low
  2196. Title: CORTEX-M3 STACK OVERFLOW
  2197. Description: There is bit bit logic in up_fullcontextrestore() that executes on
  2198. return from interrupts (and other context switches) that looks like:
  2199. ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
  2200. msr cpsr, r1 /* Set the CPSR */
  2201. /* Now recover r0 and r1 */
  2202. ldr r0, [sp]
  2203. ldr r1, [sp, #4]
  2204. add sp, sp, #(2*4)
  2205. /* Then return to the address at the stop of the stack,
  2206. * destroying the stack frame
  2207. */
  2208. ldr pc, [sp], #4
  2209. Under conditions of excessively high interrupt conditions, many
  2210. nested interrupts can occur just after the 'msr cpsr' instruction.
  2211. At that time, there are 4 bytes on the stack and, with each
  2212. interrupt, the stack pointer may increment and possibly overflow.
  2213. This can happen only under conditions of continuous interrupts.
  2214. One suggested change is:
  2215. ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
  2216. msr spsr_cxsf, r1 /* Set the CPSR */
  2217. ldmia r0, {r0-r15}^
  2218. But this has not been proven to be a solution.
  2219. UPDATE: Other ARM architectures have a similar issue.
  2220. Status: Open
  2221. Priority: Low. The conditions of continuous interrupts is really the problem.
  2222. If your design needs continuous interrupts like this, please try
  2223. the above change and, please, submit a patch with the working fix.
  2224. Title: IMPROVED TASK START-UP AND SYSCALL RETURN
  2225. Description: Couldn't up_start_task and up_start_pthread syscalls be
  2226. eliminated. Wouldn't this work to get us from kernel-
  2227. to user-mode with a system trap:
  2228. lda r13, #address
  2229. str rn, [r13]
  2230. msr spsr_SVC, rm
  2231. ld r13,{r15}^
  2232. Would also need to set r13_USER and r14_USER. For new
  2233. SYS_context_switch... couldn't we do he same thing?
  2234. Also... System calls use traps to get from user- to kernel-
  2235. mode to perform OS services. That is necessary to get from
  2236. user- to kernel-mode. But then another trap is used to get
  2237. from kernel- back to user-mode. It seems like this second
  2238. trap should be unnecessary. We should be able to do the
  2239. same kind of logic to do this.
  2240. Status: Open
  2241. Priority: Low-ish, but a good opportunity for performance improvement.
  2242. Title: USE COMMON VECTOR LOGIC IN ALL ARM ARCHITECTURES.
  2243. Description: Originally, each ARMv7-M MCU architecture had its own
  2244. private implementation for interrupt vectors and interrupt
  2245. handling logic. This was superceded by common interrupt
  2246. vector logic but these private implementations were never
  2247. removed from older MCU architectures. This is turning into
  2248. a maintenance issue because any improvements to the common
  2249. vector handling must also be re-implemented for each of the
  2250. older MCU architectures.
  2251. Status: Open
  2252. Priority: Low. A pain in the ass and an annoying implementation, but
  2253. not really an issue otherwise.
  2254. o Network Utilities (apps/netutils/)
  2255. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2256. Title: UNVERIFIED THTTPD FEATURES
  2257. Description: Not all THTTPD features/options have been verified. In
  2258. particular, there is no test case of a CGI program receiving
  2259. POST input. Only the configuration of apps/examples/thttpd
  2260. has been tested.
  2261. Status: Open
  2262. Priority: Medium
  2263. o NuttShell (NSH) (apps/nshlib)
  2264. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2265. See some NHS issues under "Kernel/Protected Build" as well.
  2266. Title: IFCONFIG AND MULTIPLE NETWORK INTERFACES
  2267. Description: The ifconfig command will not behave correctly if an interface
  2268. is provided and there are multiple interfaces. It should only
  2269. show status for the single interface on the command line; it will
  2270. still show status for all interfaces.
  2271. Status: Open
  2272. Priority: Low
  2273. o System libraries apps/system (apps/system)
  2274. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2275. Title: READLINE IMPLEMENTATION
  2276. Description: readline implementation does not use C-buffered I/O, but rather
  2277. talks to serial driver directly via read(). It includes VT-100
  2278. specific editing commands. A more generic readline() should be
  2279. implemented using termios' tcsetattr() to put the serial driver
  2280. into a "raw" mode.
  2281. Status: Open
  2282. Priority: Low (unless you are using mixed C-buffered I/O with readline and
  2283. fgetc, for example).
  2284. o Modbus (apps/modbus)
  2285. ^^^^^^^^^^^^^^^^^^^^
  2286. Title: MODBUS NOT USABLE WITH USB SERIAL
  2287. Description: Modbus can be used with USB serial, however, if the USB
  2288. serial connection is lost, Modbus will hang in an infinite
  2289. loop.
  2290. This is a problem in the handling of select() and read()
  2291. and could probably resolved by studying the Modbus error
  2292. handling.
  2293. A more USB-friendly solution would be to: (1) Re-connect and
  2294. (2) re-open the serial drviers. That is what is done is NSH.
  2295. When the serial USB device is removed, this terminates the
  2296. session and NSH will then try to re-open the USB device. See
  2297. the function nsh_waitusbready() in the file
  2298. apps/nshlib/nsh_usbconsole.c. When the USB serial is
  2299. reconnected the open() in the function will succeed and a new
  2300. session will be started.
  2301. Status: Open
  2302. Priority: Low. This is really an enhancement request: Modbus was never
  2303. designed to work with removable serial devices.
  2304. o Pascal Add-On (pcode/)
  2305. ^^^^^^^^^^^^^^^^^^^^^^
  2306. Title: P-CODES IN MEMORY UNTESTED
  2307. Description: Need APIs to verify execution of P-Code from memory buffer.
  2308. Status: Open
  2309. Priority: Low
  2310. Title: SMALLER LOADER AND OBJECT FORMAT
  2311. Description: Loader and object format may be too large for some small
  2312. memory systems. Consider ways to reduce memory footprint.
  2313. Status: Open
  2314. Priority: Medium
  2315. Title: PDBG
  2316. Description: Move the pascal p-code debugger into the NuttX apps/ tree
  2317. where it can be used from the NSH command line.
  2318. Status: Open
  2319. Priority: Low
  2320. o Other Applications & Tests (apps/examples/)
  2321. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2322. Title: EXAMPLES/PIPE ON CYGWIN
  2323. Description: The redirection test (part of examples/pipe) terminates
  2324. incorrectly on the Cywgin-based simulation platform (but works
  2325. fine on the Linux-based simulation platform).
  2326. Status: Open
  2327. Priority: Low
  2328. Title: EXAMPLES/SENDMAIL UNTESTED
  2329. Description: examples/sendmail is untested on the target (it has been tested
  2330. on the host, but not on the target).
  2331. Status: Open
  2332. Priority: Med
  2333. Title: EXAMPLES/NX FONT CACHING
  2334. Description: The font caching logic in examples/nx is incomplete. Fonts are
  2335. added to the cache, but never removed. When the cache is full
  2336. it stops rendering. This is not a problem for the examples/nx
  2337. code because it uses so few fonts, but if the logic were
  2338. leveraged for more general purposes, it would be a problem.
  2339. Update: see examples/nxtext for some improved font cache handling.
  2340. Update: The NXTERM font cache has been generalized and is now
  2341. offered as the standard, common font cache for all applications.
  2342. both the nx and nxtext examples should be modified to use this
  2343. common font cache. See interfaces defined in nxfonts.h.
  2344. Status: Open
  2345. Priority: Low. This is not really a problem because examples/nx works
  2346. fine with its bogus font caching.
  2347. Title: EXAMPLES/NXTEXT ARTIFACTS
  2348. Description: examples/nxtext. Artifacts when the pop-up window is opened.
  2349. There are some artifacts that appear in the upper left hand
  2350. corner. These seems to be related to window creation. At
  2351. tiny artifact would not be surprising (the initial window
  2352. should like at (0,0) and be of size (1,1)), but sometimes
  2353. the artifact is larger.
  2354. Status: Open
  2355. Priority: Medium.
  2356. Title: ILLEGAL CALLS TO romdisk_register()
  2357. Description: Several examples (and other things under apps/) make illegal
  2358. calls to romdisk_register(). This both violates the portable
  2359. POSIX OS interface and makes these applications un-usable in
  2360. PROTECTED and KERNEL build modes.
  2361. Non-compliant examples include:
  2362. examples/bastest, examples/elf, examples/module,
  2363. examples/nxflat, examples/posix_spawn, examples/romfs,
  2364. examples/sotest, examples/thttpd, examples/unionfs
  2365. These examples are simple demos and, hence, you could argue that
  2366. it is not so bad that they violate the interface for the purpose
  2367. of demonstration (although they do set a bad example because of
  2368. this).
  2369. These examples should, of course, use boardctl(BOARDIOC_ROMDISK)
  2370. to create the ROM disk instead of calling romdisk_register()
  2371. directly.
  2372. Status: Open
  2373. Priority: Medium.