TODO 144 KB

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