Kconfig 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772
  1. #
  2. # For a description of the syntax of this configuration file,
  3. # see the file kconfig-language.txt in the NuttX tools repository.
  4. #
  5. menuconfig DISABLE_OS_API
  6. bool "Disable NuttX interfaces"
  7. default y
  8. ---help---
  9. The following can be used to disable categories of
  10. APIs supported by the OS. If the compiler supports
  11. weak functions, then it should not be necessary to
  12. disable functions unless you want to restrict usage
  13. of those APIs.
  14. There are certain dependency relationships in these
  15. features.
  16. 1) mq_notify logic depends on signals to awaken tasks
  17. waiting for queues to become full or empty.
  18. 2) pthread_condtimedwait() depends on signals to wake
  19. up waiting tasks.
  20. if DISABLE_OS_API
  21. config DISABLE_POSIX_TIMERS
  22. bool "Disable POSIX timers"
  23. default y if DEFAULT_SMALL
  24. default n if !DEFAULT_SMALL
  25. ---help---
  26. Disable support for the the entire POSIX timer family
  27. including timer_create(), timer_gettime(), timer_settime(),
  28. etc.
  29. NOTE: This option will also disable getitimer() and
  30. setitimer() which are not, strictly speaking, POSIX timers.
  31. config DISABLE_PTHREAD
  32. bool "Disable pthread support"
  33. default n
  34. config DISABLE_MQUEUE
  35. bool "Disable POSIX message queue support"
  36. default n
  37. config DISABLE_ENVIRON
  38. bool "Disable environment variable support"
  39. default y if DEFAULT_SMALL
  40. default n if !DEFAULT_SMALL
  41. endif # DISABLE_OS_API
  42. menu "Clocks and Timers"
  43. config ARCH_HAVE_TICKLESS
  44. bool
  45. config SCHED_TICKLESS
  46. bool "Support tick-less OS"
  47. default n
  48. depends on ARCH_HAVE_TICKLESS
  49. ---help---
  50. By default, system time is driven by a periodic timer interrupt. An
  51. alternative configurations is a tick-less configuration in which
  52. there is no periodic timer interrupt. Instead and interval timer is
  53. used to schedule the next OS time event. This option selects that
  54. tick-less OS option. If the tick-less OS is selected, then there are
  55. additional platform specific interfaces that must be provided as
  56. defined include/nuttx/arch.h
  57. if SCHED_TICKLESS
  58. config SCHED_TICKLESS_ALARM
  59. bool "Tickless alarm"
  60. default n
  61. ---help---
  62. The tickless option can be supported either via a simple interval
  63. timer (plus elapsed time) or via an alarm. The interval timer allows
  64. programming events to occur after an interval. With the alarm,
  65. you can set a time in the future and get an event when that alarm
  66. goes off. This option selects the use of an alarm.
  67. The advantage of an alarm is that it avoids some small timing
  68. errors; the advantage of the use of the interval timer is that
  69. the hardware requirement may be less.
  70. config SCHED_TICKLESS_LIMIT_MAX_SLEEP
  71. bool "Max sleep period (in microseconds)"
  72. default n
  73. ---help---
  74. Enables use of the g_oneshot_maxticks variable. This variable is
  75. initialized by platform-specific logic at runtime to the maximum
  76. delay that the timer can wait (in configured clock ticks). The
  77. RTOS tickless logic will then limit all requested delays to this
  78. value.
  79. endif
  80. config USEC_PER_TICK
  81. int "System timer tick period (microseconds)"
  82. default 10000 if !SCHED_TICKLESS
  83. default 100 if SCHED_TICKLESS
  84. ---help---
  85. In the "normal" configuration where system time is provided by a
  86. periodic timer interrupt, the default system timer is expected to
  87. run at 100Hz or USEC_PER_TICK=10000. This setting must be defined
  88. to inform of NuttX the interval that the processor hardware is
  89. providing system timer interrupts to the OS.
  90. If SCHED_TICKLESS is selected, then there are no system timer
  91. interrupts. In this case, USEC_PER_TICK does not control any timer
  92. rates. Rather, it only determines the resolution of time reported
  93. by clock_systime_ticks() and the resolution of times that can be set for
  94. certain delays including watchdog timers and delayed work. In this
  95. case there is a trade-off: It is better to have the USEC_PER_TICK as
  96. low as possible for higher timing resolution. However, the time
  97. is currently held in 'unsigned int' on some systems, this may be
  98. 16-bits but on most contemporary systems it will be 32-bits. In
  99. either case, smaller values of USEC_PER_TICK will reduce the range
  100. of values that delays that can be represented. So the trade-off is
  101. between range and resolution (you could also modify the code to use
  102. a 64-bit value if you really want both).
  103. The default, 100 microseconds, will provide for a range of delays
  104. up to 120 hours.
  105. This value should never be less than the underlying resolution of
  106. the timer. Error may ensue.
  107. if !SCHED_TICKLESS
  108. config SYSTEMTICK_EXTCLK
  109. bool "Use external clock"
  110. default n
  111. depends on ARCH_HAVE_EXTCLK
  112. ---help---
  113. Use external clock for system tick. When enabled, the platform-specific
  114. logic must start its own timer interrupt to make periodic calls to the
  115. nxsched_process_timer() or the functions called within. The purpose is
  116. to move the scheduling off the processor clock to allow entering low
  117. power states that would disable that clock.
  118. config SYSTEMTICK_HOOK
  119. bool "System timer hook"
  120. default n
  121. ---help---
  122. Enable a call to a user-provided, board-level function on each timer
  123. tick. This permits custom actions that may be performed on each
  124. timer tick. The form of the user-provided function is:
  125. void board_timerhook(void);
  126. (prototyped in include/nuttx/board.h).
  127. endif # !SCHED_TICKLESS
  128. config SYSTEM_TIME64
  129. bool "64-bit system clock"
  130. default n
  131. ---help---
  132. The system timer is incremented at the rate determined by
  133. USEC_PER_TICK, typically at 100Hz. The count at any given time is
  134. then the "uptime" in units of system timer ticks. By default, the
  135. system time is 32-bits wide. Those defaults provide a range of about
  136. 497 days which is probably a sufficient range for "uptime".
  137. However, if the system timer rate is significantly higher than 100Hz
  138. and/or if a very long "uptime" is required, then this option can be
  139. selected to support a 64-bit wide timer.
  140. config CLOCK_MONOTONIC
  141. bool "Support CLOCK_MONOTONIC"
  142. default n
  143. ---help---
  144. CLOCK_MONOTONIC is an optional standard POSIX clock. Unlike
  145. CLOCK_REALTIME which can move forward and backward when the
  146. time-of-day changes, CLOCK_MONOTONIC is the elapsed time since some
  147. arbitrary point in the post (the system start-up time for NuttX)
  148. and, hence, is always monotonically increasing. CLOCK_MONOTONIC
  149. is, hence, the more appropriate clock for determining time
  150. differences.
  151. The value of the CLOCK_MONOTONIC clock cannot be set via clock_settime().
  152. config ARCH_HAVE_TIMEKEEPING
  153. bool
  154. default n
  155. config CLOCK_TIMEKEEPING
  156. bool "Support timekeeping algorithms"
  157. default n
  158. depends on EXPERIMENTAL && ARCH_HAVE_TIMEKEEPING
  159. ---help---
  160. CLOCK_TIMEKEEPING enables experimental time management algorithms.
  161. config JULIAN_TIME
  162. bool "Enables Julian time conversions"
  163. default n
  164. ---help---
  165. Enables Julian time conversions
  166. config START_YEAR
  167. int "Start year"
  168. default 2018
  169. range 1970 2106
  170. ---help---
  171. NuttX uses an unsigned 32-bit integer for time_t which provides a
  172. range from 1970 to 2106.
  173. config START_MONTH
  174. int "Start month"
  175. default 1
  176. range 1 12
  177. config START_DAY
  178. int "Start day"
  179. default 1
  180. range 1 31
  181. config PREALLOC_TIMERS
  182. int "Number of pre-allocated POSIX timers"
  183. default 8
  184. ---help---
  185. The number of pre-allocated POSIX timer structures. The system manages a
  186. pool of preallocated timer structures to minimize dynamic allocations. Set to
  187. zero for all dynamic allocations.
  188. endmenu # Clocks and Timers
  189. menu "Tasks and Scheduling"
  190. config SPINLOCK
  191. bool "Support Spinlocks"
  192. default n
  193. depends on ARCH_HAVE_TESTSET
  194. ---help---
  195. Enables support for spinlocks. Spinlocks are used primarily for
  196. synchronization in SMP configurations but are available for general
  197. synchronization between CPUs. Use in a single CPU configuration would
  198. most likely be fatal. Note, however, that this does not depend on
  199. CONFIG_ARCH_HAVE_MULTICPU. This permits the use of spinlocks in
  200. other novel architectures.
  201. config SPINLOCK_IRQ
  202. bool "Support Spinlocks with IRQ control"
  203. default n
  204. ---help---
  205. Enables support for spinlocks with IRQ control. This feature can be
  206. used to protect data in SMP mode.
  207. config IRQCHAIN
  208. bool "Enable multi handler sharing a IRQ"
  209. default n
  210. ---help---
  211. Enable support for IRQCHAIN.
  212. if IRQCHAIN
  213. config PREALLOC_IRQCHAIN
  214. int "Number of pre-allocated irq chains"
  215. default 8
  216. ---help---
  217. The number of pre-allocated irq chain structures. The system manages
  218. a pool of preallocated irq chain structures to minimize dynamic
  219. allocations. You will, however, get better performance and memory
  220. usage if this value is tuned to minimize such allocations.
  221. endif # IRQCHAIN
  222. config IRQCOUNT
  223. bool
  224. default n
  225. config SMP
  226. bool "Symmetric Multi-Processing (SMP)"
  227. default n
  228. depends on ARCH_HAVE_MULTICPU
  229. select SPINLOCK
  230. select SCHED_RESUMESCHEDULER
  231. select IRQCOUNT
  232. ---help---
  233. Enables support for Symmetric Multi-Processing (SMP) on a multi-CPU
  234. platform.
  235. if SMP
  236. config SMP_NCPUS
  237. int "Number of CPUs"
  238. default 4
  239. range 1 32 if DEBUG_FEATURES
  240. range 2 32 if !DEBUG_FEATURES
  241. ---help---
  242. This value identifies the number of CPUs supported by the processor
  243. that will be used for SMP.
  244. If CONFIG_DEBUG_FEATURES is enabled, then the value one is permitted
  245. for CONFIG_SMP_NCPUS. This is not normally a valid setting for an
  246. SMP configuration. However, running the SMP logic in a single CPU
  247. configuration is useful during certain testing.
  248. config SMP_IDLETHREAD_STACKSIZE
  249. int "CPU IDLE stack size"
  250. default DEFAULT_TASK_STACKSIZE
  251. ---help---
  252. Each CPU will have its own IDLE task. System initialization occurs
  253. on CPU0 and uses CONFIG_IDLETHREAD_STACKSIZE which will probably be
  254. larger than is generally needed. This setting provides the stack
  255. size for the IDLE task on CPUS 1 through (CONFIG_SMP_NCPUS-1).
  256. endif # SMP
  257. choice
  258. prompt "Initialization Task"
  259. default INIT_ENTRYPOINT if !BUILD_KERNEL
  260. default INIT_FILEPATH if !BINFMT_DISABLE
  261. default INIT_NONE if BINFMT_DISABLE
  262. config INIT_NONE
  263. bool "None"
  264. config INIT_ENTRYPOINT
  265. bool "Via application entry point"
  266. depends on !BUILD_KERNEL
  267. config INIT_FILEPATH
  268. bool "Via executable file"
  269. depends on !BINFMT_DISABLE
  270. endchoice # Initialization task
  271. config INIT_ARGS
  272. string "Application argument list"
  273. depends on !INIT_NONE
  274. ---help---
  275. The argument list for user applications. e.g.:
  276. "\"arg1\",\"arg2\",\"arg3\""
  277. if INIT_ENTRYPOINT
  278. config USER_ENTRYPOINT
  279. string "Application entry point"
  280. default "main"
  281. ---help---
  282. The name of the entry point for user applications. For the example
  283. applications this is of the form 'app_main' where 'app' is the application
  284. name. If not defined, USER_ENTRYPOINT defaults to "main".
  285. config USERMAIN_STACKSIZE
  286. int "Main thread stack size"
  287. default DEFAULT_TASK_STACKSIZE
  288. ---help---
  289. The size of the stack to allocate for the user initialization thread
  290. that is started as soon as the OS completes its initialization.
  291. config USERMAIN_PRIORITY
  292. int "init thread priority"
  293. default 100
  294. ---help---
  295. The priority of the user initialization thread.
  296. endif # INIT_ENTRYPOINT
  297. if INIT_FILEPATH
  298. config USER_INITPATH
  299. string "Application initialization path"
  300. default "/bin/init"
  301. ---help---
  302. The name of the entry point for user applications. For the example
  303. applications this is of the form 'app_main' where 'app' is the application
  304. name. If not defined, USER_ENTRYPOINT defaults to "main".
  305. config INIT_SYMTAB
  306. string "Symbol table"
  307. default "NULL" if !EXECFUNCS_HAVE_SYMTAB
  308. default EXECFUNCS_SYMTAB_ARRAY if EXECFUNCS_HAVE_SYMTAB
  309. depends on BUILD_FLAT
  310. ---help---
  311. The name of other global array that holds the exported symbol table.
  312. The special string "NULL" may be provided if there is no symbol
  313. table. Quotation marks will be stripped when config.h is generated.
  314. NOTE: This setting cannot be used in protected or kernel builds.
  315. Any kernel mode symbols tables would not be usable for resolving
  316. symbols in user mode executables.
  317. config INIT_NEXPORTS
  318. string "Symbol table size"
  319. default "0" if !EXECFUNCS_HAVE_SYMTAB
  320. default EXECFUNCS_NSYMBOLS_VAR if EXECFUNCS_HAVE_SYMTAB
  321. depends on BUILD_FLAT
  322. ---help---
  323. The size of the symbol table. NOTE that is is logically a numeric
  324. value but is represent by a string. That allows you to put
  325. sizeof(something) or a macro or a global variable name for the
  326. symbol table size. Quotation marks will be stripped when config.h
  327. is generated.
  328. NOTE: This setting cannot be used in protected or kernel builds.
  329. Any kernel mode symbols tables would not be usable for resolving
  330. symbols in user mode executables.
  331. menuconfig INIT_MOUNT
  332. bool "Auto-mount init file system"
  333. default n
  334. depends on !DISABLE_MOUNTPOINT
  335. ---help---
  336. In order to use the the initial startup program when CONFIG_INIT_FILEPATH
  337. is provided, it is necessary to mount the initial file system that
  338. provides init program. Normally this mount is done in the board-specific
  339. initialization logic. However, if the mount is very simple, it can be
  340. performed by the OS bring-up logic itself by selecting this option.
  341. if INIT_MOUNT
  342. config INIT_MOUNT_SOURCE
  343. string "The block device to mount"
  344. default "/dev/ram0"
  345. config INIT_MOUNT_TARGET
  346. string "Path to the mounted file system"
  347. default "/bin"
  348. config INIT_MOUNT_FSTYPE
  349. string "The file system type to mount"
  350. default "romfs"
  351. config INIT_MOUNT_FLAGS
  352. hex "Flags passed to mount"
  353. default 0
  354. config INIT_MOUNT_DATA
  355. string "Additional data passed to mount"
  356. default ""
  357. endif # INIT_MOUNT
  358. endif # INIT_FILEPATH
  359. config RR_INTERVAL
  360. int "Round robin timeslice (MSEC)"
  361. default 0
  362. ---help---
  363. The round robin timeslice will be set this number of milliseconds;
  364. Round robin scheduling (SCHED_RR) is enabled by setting this
  365. interval to a positive, non-zero value.
  366. config SCHED_SPORADIC
  367. bool "Support sporadic scheduling"
  368. default n
  369. select SCHED_SUSPENDSCHEDULER
  370. select SCHED_RESUMESCHEDULER
  371. ---help---
  372. Build in additional logic to support sporadic scheduling
  373. (SCHED_SPORADIC).
  374. if SCHED_SPORADIC
  375. config SCHED_SPORADIC_MAXREPL
  376. int "Maximum number of replenishments"
  377. default 3
  378. range 1 255
  379. ---help---
  380. Controls the size of allocated replenishment structures and, hence,
  381. also limits the maximum number of replenishments.
  382. config SPORADIC_INSTRUMENTATION
  383. bool "Sporadic scheduler monitor hooks"
  384. default n
  385. ---help---
  386. Enables instrumentation in the sporadic scheduler to monitor
  387. scheduler behavior. If enabled, then the board-specific logic must
  388. provide the following functions:
  389. void arch_sporadic_start(FAR struct tcb_s *tcb);
  390. void arch_sporadic_lowpriority(FAR struct tcb_s *tcb);
  391. void arch_sporadic_suspend(FAR struct tcb_s *tcb);
  392. void arch_sporadic_resume(FAR struct tcb_s *tcb);
  393. endif # SCHED_SPORADIC
  394. config TASK_NAME_SIZE
  395. int "Maximum task name size"
  396. default 31
  397. ---help---
  398. Specifies the maximum size of a task name to save in the TCB.
  399. Useful if scheduler instrumentation is selected. Set to zero to
  400. disable. Excludes the NUL terminator; the actual allocated size
  401. will be TASK_NAME_SIZE + 1. The default of 31 then results in
  402. a align-able 32-byte allocation.
  403. config MAX_TASKS
  404. int "Max number of tasks"
  405. default 32
  406. ---help---
  407. The maximum number of simultaneously active tasks. This value must be
  408. a power of two.
  409. config SCHED_HAVE_PARENT
  410. bool "Support parent/child task relationships"
  411. default n
  412. ---help---
  413. Remember the ID of the parent task when a new child task is
  414. created. This support enables some additional features (such as
  415. SIGCHLD) and modifies the behavior of other interfaces. For
  416. example, it makes waitpid() more standards complete by restricting
  417. the waited-for tasks to the children of the caller. Default:
  418. disabled.
  419. config SCHED_CHILD_STATUS
  420. bool "Retain child exit status"
  421. default n
  422. depends on SCHED_HAVE_PARENT
  423. ---help---
  424. If this option is selected, then the exit status of the child task
  425. will be retained after the child task exits. This option should be
  426. selected if you require knowledge of a child process's exit status.
  427. Without this setting, wait(), waitpid() or waitid() may fail. For
  428. example, if you do:
  429. 1) Start child task
  430. 2) Wait for exit status (using wait(), waitpid(), or waitid()).
  431. This can fail because the child task may run to completion before
  432. the wait begins. There is a non-standard work-around in this case:
  433. The above sequence will work if you disable pre-emption using
  434. sched_lock() prior to starting the child task, then re-enable pre-
  435. emption with sched_unlock() after the wait completes. This works
  436. because the child task is not permitted to run until the wait is in
  437. place.
  438. The standard solution would be to enable SCHED_CHILD_STATUS. In
  439. this case the exit status of the child task is retained after the
  440. child exits and the wait will successful obtain the child task's
  441. exit status whether it is called before the child task exits or not.
  442. Warning: If you enable this feature, then your application must
  443. either (1) take responsibility for reaping the child status with wait(),
  444. waitpid(), or waitid(), or (2) suppress retention of child status.
  445. If you do not reap the child status, then you have a memory leak and
  446. your system will eventually fail.
  447. Retention of child status can be suppressed on the parent using logic like:
  448. struct sigaction sa;
  449. sa.sa_handler = SIG_IGN;
  450. sa.sa_flags = SA_NOCLDWAIT;
  451. int ret = sigaction(SIGCHLD, &sa, NULL);
  452. if SCHED_CHILD_STATUS
  453. config PREALLOC_CHILDSTATUS
  454. int "Number of pre-allocated child status"
  455. default 0
  456. ---help---
  457. To prevent runaway child status allocations and to improve
  458. allocation performance, child task exit status structures are pre-
  459. allocated when the system boots. This setting determines the number
  460. of child status structures that will be pre-allocated. If this
  461. setting is not defined or if it is defined to be zero then a value
  462. of 2*MAX_TASKS is used.
  463. Note that there cannot be more than MAX_TASKS tasks in total.
  464. However, the number of child status structures may need to be
  465. significantly larger because this number includes the maximum number
  466. of tasks that are running PLUS the number of tasks that have exit'ed
  467. without having their exit status reaped (via wait(), waitid(), or
  468. waitpid()).
  469. Obviously, if tasks spawn children indefinitely and never have the
  470. exit status reaped, then you may have a memory leak! If you enable
  471. the SCHED_CHILD_STATUS feature, then your application must take
  472. responsibility for either (1) reaping the child status with wait(),
  473. waitpid(), or waitid() or it must (2) suppress retention of child
  474. status. Otherwise, your system will eventually fail.
  475. Retention of child status can be suppressed on the parent using logic like:
  476. struct sigaction sa;
  477. sa.sa_handler = SIG_IGN;
  478. sa.sa_flags = SA_NOCLDWAIT;
  479. int ret = sigaction(SIGCHLD, &sa, NULL);
  480. config DEBUG_CHILDSTATUS
  481. bool "Enable Child Status Debug Output"
  482. default n
  483. depends on SCHED_CHILD_STATUS && DEBUG_FEATURES
  484. ---help---
  485. Very detailed... I am sure that you do not want this.
  486. endif # SCHED_CHILD_STATUS
  487. config SCHED_WAITPID
  488. bool "Enable waitpid() API"
  489. default n
  490. ---help---
  491. Enables the waitpid() interface in a default, non-standard mode
  492. (non-standard in the sense that the waited for PID need not be child
  493. of the caller). If SCHED_HAVE_PARENT is also defined, then this
  494. setting will modify the behavior or waitpid() (making more spec
  495. compliant) and will enable the waitid() and wait() interfaces as
  496. well.
  497. config SCHED_USER_IDENTITY
  498. bool "Support per-task User Identity"
  499. default n
  500. ---help---
  501. This selection enables functionality of getuid(), setuid(), getgid(),
  502. setgid(). If this option is not selected, then stub, root-only
  503. versions of these interfaces are available. When selected, these
  504. interfaces will associate a UID and/or GID with each task group.
  505. Those can then be managed using the interfaces. Child tasks will
  506. inherit the UID and GID of its parent.
  507. endmenu # Tasks and Scheduling
  508. menu "Pthread Options"
  509. depends on !DISABLE_PTHREAD
  510. config PTHREAD_MUTEX_TYPES
  511. bool "Enable mutex types"
  512. default n
  513. ---help---
  514. Set to enable support for recursive and errorcheck mutexes. Enables
  515. pthread_mutexattr_settype().
  516. choice
  517. prompt "pthread mutex robustness"
  518. default PTHREAD_MUTEX_ROBUST if !DEFAULT_SMALL
  519. default PTHREAD_MUTEX_UNSAFE if DEFAULT_SMALL
  520. config PTHREAD_MUTEX_ROBUST
  521. bool "Robust mutexes"
  522. ---help---
  523. Support only the robust form of the NORMAL mutex.
  524. config PTHREAD_MUTEX_UNSAFE
  525. bool "Traditional unsafe mutexes"
  526. ---help---
  527. Support only the traditional non-robust form of the NORMAL mutex.
  528. You should select this option only for backward compatibility with
  529. software you may be porting or, perhaps, if you are trying to minimize
  530. footprint.
  531. config PTHREAD_MUTEX_BOTH
  532. bool "Both robust and unsafe mutexes"
  533. ---help---
  534. Support both forms of NORMAL mutexes.
  535. endchoice # pthread mutex robustness
  536. choice
  537. prompt "Default NORMAL mutex robustness"
  538. default PTHREAD_MUTEX_DEFAULT_ROBUST
  539. depends on PTHREAD_MUTEX_BOTH
  540. config PTHREAD_MUTEX_DEFAULT_ROBUST
  541. bool "Robust default"
  542. ---help---
  543. The default is robust NORMAL mutexes (non-standard)
  544. config PTHREAD_MUTEX_DEFAULT_UNSAFE
  545. bool "Unsafe default"
  546. ---help---
  547. The default is traditional unsafe NORMAL mutexes (standard)
  548. endchoice # Default NORMAL mutex robustness
  549. config PTHREAD_CLEANUP
  550. bool "pthread cleanup stack"
  551. default n
  552. ---help---
  553. Select to enable support for pthread exit cleanup stacks. This
  554. enables the interfaces pthread_cleanup_push() and
  555. pthread_cleanup_pop().
  556. config PTHREAD_CLEANUP_STACKSIZE
  557. int "pthread cleanup stack size"
  558. default 1
  559. range 1 32
  560. depends on PTHREAD_CLEANUP
  561. ---help---
  562. The maximum number of cleanup actions that may be pushed by
  563. pthread_clean_push(). This setting will increase the size of EVERY
  564. pthread task control block by about n * CONFIG_PTHREAD_CLEANUP_STACKSIZE
  565. where n is the size of a pointer, 2* sizeof(uintptr_t), this would be
  566. 8 for a CPU with 32-bit addressing and 4 for a CPU with 16-bit
  567. addressing.
  568. config CANCELLATION_POINTS
  569. bool "Cancellation points"
  570. default n
  571. ---help---
  572. Enable POSIX cancellation points for pthread_cancel(). If selected,
  573. cancellation points will also used with the () task_delete() API even if
  574. pthreads are not enabled.
  575. endmenu # Pthread Options
  576. menu "Performance Monitoring"
  577. config SCHED_SUSPENDSCHEDULER
  578. bool
  579. default n
  580. config SCHED_RESUMESCHEDULER
  581. bool
  582. default n
  583. config SCHED_IRQMONITOR
  584. bool "Enable IRQ monitoring"
  585. default n
  586. depends on FS_PROCFS
  587. ---help---
  588. Enabling counting of interrupts from all interrupt sources. These
  589. counts will be available in the mounted procfs file systems at the
  590. top-level file, "irqs".
  591. config SCHED_CRITMONITOR
  592. bool "Enable Critical Section monitoring"
  593. default n
  594. depends on FS_PROCFS
  595. select SCHED_SUSPENDSCHEDULER
  596. select SCHED_RESUMESCHEDULER
  597. select IRQCOUNT
  598. ---help---
  599. Enables logic that monitors the duration of time that a thread keeps
  600. interrupts or pre-emption disabled. These global locks can have
  601. negative consequences to real timer performance: Disabling interrupts
  602. adds jitter in the time when a interrupt request is asserted until
  603. the hardware can responds with the interrupt. Disabling pre-emption
  604. adds jitter in the timer from when the event is posted in the
  605. interrupt handler until the task that responds to the event can run.
  606. If this option is selected, then the following interfaces must be
  607. provided by platform-specific logic:
  608. uint32_t up_critmon_gettime(void);
  609. void up_critmon_convert(uint32_t elapsed, FAR struct timespec *ts);
  610. The first interface simply provides the current time value in unknown
  611. units. NOTE: This function may be called early before the timer has
  612. been initialized. In that event, the function should just return a
  613. start time of zero.
  614. Nothing is assumed about the units of this time value. The following
  615. are assumed, however: (1) The time is an unsigned integer value, (2)
  616. the time is monotonically increasing, and (3) the elapsed time (also
  617. in unknown units) can be obtained by subtracting a start time from
  618. the current time.
  619. The second interface simple converts an elapsed time into well known
  620. units for presentation by the ProcFS file system.
  621. config SCHED_CPULOAD
  622. bool "Enable CPU load monitoring"
  623. default n
  624. select SCHED_CPULOAD_EXTCLK if SCHED_TICKLESS
  625. ---help---
  626. If this option is selected, the timer interrupt handler will monitor
  627. if the system is IDLE or busy at the time of that the timer interrupt
  628. occurs. This is a very coarse measurement, but over a period of time,
  629. it can very accurately determined the percentage of the time that the
  630. CPU is IDLE.
  631. The statistics collected in this could be used, for example in the
  632. PROCFS file system to provide CPU load measurements when read.
  633. Note that in tickless mode of operation (SCHED_TICKLESS) there is
  634. no system timer interrupt and CPU load measurements will not be
  635. possible unless you provide an alternative clock to driver the
  636. sampling and select SCHED_CPULOAD_EXTCLK.
  637. if SCHED_CPULOAD
  638. config SCHED_CPULOAD_EXTCLK
  639. bool "Use external clock"
  640. default n
  641. ---help---
  642. The CPU load measurements are determined by sampling the active
  643. tasks periodically at the occurrence to a timer expiration. By
  644. default, the system clock is used to do that sampling.
  645. There is a serious issue for the accuracy of measurements if the
  646. system clock is used, however. NuttX threads are often started at
  647. the time of the system timer expiration. Others may be stopped at
  648. the time of the system timer expiration (if round-robin time-slicing
  649. is enabled). Such thread behavior occurs synchronously with the
  650. system timer and, hence, is not randomly sampled. As a consequence,
  651. the CPU load attributed to these threads that run synchronously with
  652. they system timer may be grossly in error.
  653. The solution is to use some other clock that runs at a different
  654. rate and has timer expirations that are asynchronous with the
  655. system timer. Then truly accurate load measurements can be
  656. achieved. This option enables use of such an "external" clock. The
  657. implementation of the clock must be provided by platform-specific
  658. logic; that platform-specific logic must call the system function
  659. nxsched_process_cpuload() at each timer expiration with interrupts
  660. disabled.
  661. if SCHED_CPULOAD_EXTCLK
  662. config SCHED_CPULOAD_TICKSPERSEC
  663. int "External clock rate"
  664. default 100
  665. ---help---
  666. If an external clock is used to drive the sampling for the CPU load
  667. calculations, then this value must be provided. This value provides
  668. the rate of the external clock interrupts in units of ticks per
  669. second. The default value of 100 corresponds to a 100Hz clock. NOTE:
  670. that 100Hz is the default frequency of the system time and, hence,
  671. the worst possible choice in most cases.
  672. choice
  673. prompt "Select CPU load timer"
  674. default CPULOAD_ONESHOT
  675. config CPULOAD_ONESHOT
  676. bool "Use Oneshot timer"
  677. ---help---
  678. Use an MCU-specific oneshot timer as the external clock. The
  679. oneshot timer must be configured by board specific logic which must
  680. then call:
  681. void nxsched_oneshot_extclk(FAR struct oneshot_lowerhalf_s *lower);
  682. To start the CPU load measurement. See include/nuttx/clock.h
  683. NOTE that in this configuration, CONFIG_SCHED_CPULOAD_TICKSPERSEC is
  684. the sample rate that will be accomplished by programming the oneshot
  685. time repeatedly. If CPULOAD_ONESHOT_ENTROPY is also selected, then
  686. the underly frequency driving the oneshot timer must be
  687. significantly faster than CONFIG_SCHED_CPULOAD_TICKSPERSE to permit
  688. precise modulation the sample periods.
  689. config CPULOAD_PERIOD
  690. bool "Use Period timer"
  691. ---help---
  692. Use an MCU-specific period timer as the external clock. The
  693. period timer must be configured by board specific logic which must
  694. then call:
  695. void nxsched_period_extclk(FAR struct timer_lowerhalf_s *lower);
  696. To start the CPU load measurement. See include/nuttx/clock.h
  697. NOTE that in this configuration, CONFIG_SCHED_CPULOAD_TICKSPERSEC is
  698. the sample rate that will be accomplished by programming the period
  699. time.
  700. endchoice
  701. config CPULOAD_ENTROPY
  702. int "Bits of entropy"
  703. default 6
  704. range 0 30
  705. depends on CPULOAD_ONESHOT
  706. ---help---
  707. This is the number of bits of entropy that will be applied. The
  708. oneshot will be set to this interval:
  709. CPULOAD_ONESHOT_NOMINAL - (CPULOAD_ONESHOT_ENTROPY / 2) +
  710. error + nrand(CPULOAD_ONESHOT_ENTROPY)
  711. Where
  712. CPULOAD_ONESHOT_NOMINAL is the nominal sample interval implied
  713. by CONFIG_SCHED_CPULOAD_TICKSPERSEC in units of microseconds.
  714. CPULOAD_ONESHOT_ENTROPY is (1 << CONFIG_CPULOAD_ENTROPY),
  715. and 'error' is an error value that is retained from interval to
  716. interval so that although individual intervals are randomized,
  717. the average will still be CONFIG_SCHED_CPULOAD_TICKSPERSEC.
  718. This special value of zero disables entropy.
  719. endif # SCHED_CPULOAD_EXTCLK
  720. config SCHED_CPULOAD_TIMECONSTANT
  721. int "CPU load time constant"
  722. default 2
  723. ---help---
  724. The accumulated CPU count is divided by two when the accumulated
  725. tick count exceeds this time constant. This time constant is in
  726. units of seconds.
  727. endif # SCHED_CPULOAD
  728. config SCHED_INSTRUMENTATION
  729. bool "System performance monitor hooks"
  730. default n
  731. select SCHED_SUSPENDSCHEDULER
  732. select SCHED_RESUMESCHEDULER
  733. ---help---
  734. Enables instrumentation in scheduler to monitor system performance.
  735. If enabled, then the board-specific logic must provide the following
  736. functions (see include/sched.h):
  737. void sched_note_start(FAR struct tcb_s *tcb);
  738. void sched_note_stop(FAR struct tcb_s *tcb);
  739. void sched_note_suspend(FAR struct tcb_s *tcb);
  740. void sched_note_resume(FAR struct tcb_s *tcb);
  741. If CONFIG_SMP is enabled, then these additional interfaces are
  742. expected:
  743. void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
  744. void sched_note_cpu_paused(FAR struct tcb_s *tcb);
  745. void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
  746. void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
  747. NOTE: These are internal OS interfaces and are called at at very
  748. critical locations in the OS. There is very little that can be
  749. done in these interfaces. For example, normal devices may not be
  750. used; syslog output cannot be performed.
  751. if SCHED_INSTRUMENTATION
  752. config SCHED_INSTRUMENTATION_EXTERNAL
  753. bool "System performance monitor endpoints are external"
  754. default n
  755. ---help---
  756. When this option is enabled, the board specific logic must implment all
  757. callbacks listed in SCHED_INSTRUMENTATION, SCHED_INSTRUMENTATION_CSECTION,
  758. SCHED_INSTRUMENTATION_SPINLOCKS, SCHED_INSTRUMENTATION_SYSCALL and
  759. SCHED_INSTRUMENTATION_IRQHANDLER. Otherwise the common code will implement
  760. these callbacks and packet the arguments into note_ struct. Then the board
  761. -specific logic just need to implement one callback:
  762. void sched_note_add(FAR const void *note, size_t notelen);
  763. and send the data to the suitable transport hardware.
  764. config SCHED_INSTRUMENTATION_CPUSET
  765. hex "CPU bit set"
  766. default 0xffff
  767. depends on SMP && SCHED_INSTRUMENTATION_FILTER
  768. ---help---
  769. Monitor only CPUs in the bitset. Bit 0=CPU0, Bit1=CPU1, etc.
  770. config SCHED_INSTRUMENTATION_PREEMPTION
  771. bool "Preemption monitor hooks"
  772. default n
  773. ---help---
  774. Enables additional hooks for changes to pre-emption state. Board-
  775. specific logic must provide this additional logic.
  776. void sched_note_premption(FAR struct tcb_s *tcb, bool state);
  777. config SCHED_INSTRUMENTATION_CSECTION
  778. bool "Critical section monitor hooks"
  779. default n
  780. select IRQCOUNT
  781. ---help---
  782. Enables additional hooks for entry and exit from critical sections.
  783. Interrupts are disabled while within a critical section. Board-
  784. specific logic must provide this additional logic.
  785. void sched_note_csection(FAR struct tcb_s *tcb, bool state);
  786. config SCHED_INSTRUMENTATION_SPINLOCKS
  787. bool "Spinlock monitor hooks"
  788. default n
  789. ---help---
  790. Enables additional hooks for spinlock state. Board-specific logic
  791. must provide this additional logic.
  792. void sched_note_spinlock(FAR struct tcb_s *tcb, bool state);
  793. void sched_note_spinlocked(FAR struct tcb_s *tcb, bool state);
  794. void sched_note_spinunlock(FAR struct tcb_s *tcb, bool state);
  795. void sched_note_spinabort(FAR struct tcb_s *tcb, bool state);
  796. config SCHED_INSTRUMENTATION_SYSCALL
  797. bool "System call monitor hooks"
  798. default n
  799. depends on ARCH_HAVE_SYSCALL_HOOKS
  800. ---help---
  801. Enables additional hooks for entry and exit from system call.
  802. Board-specific logic must provide this additional logic.
  803. void sched_note_syscall_enter(int nr, int argc, ...);
  804. void sched_note_syscall_leave(int nr, uintptr_t result);
  805. config SCHED_INSTRUMENTATION_IRQHANDLER
  806. bool "Interrupt handler monitor hooks"
  807. default n
  808. ---help---
  809. Enables additional hooks for interrupt handler. Board-specific logic
  810. must provide this additional logic.
  811. void sched_note_irqhandler(int irq, FAR void *handler, bool enter);
  812. config SCHED_INSTRUMENTATION_HIRES
  813. bool "Use Hi-Res RTC for instrumentation"
  814. default n
  815. ---help---
  816. Use higher resolution system timer for instrumentation.
  817. config SCHED_INSTRUMENTATION_FILTER
  818. bool "Instrumenation filter"
  819. default n
  820. ---help---
  821. Enables the filter logic for the instrumentation. If this option
  822. is enabled, the instrumentation data passed to sched_note_add()
  823. can be filtered by syscall and IRQ number.
  824. The filter logic can be configured by sched_note_filter APIs defined in
  825. include/nuttx/sched_note.h.
  826. config SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
  827. hex "Default instrumentation filter mode"
  828. depends on SCHED_INSTRUMENTATION_FILTER
  829. default 0xf
  830. ---help---
  831. Default mode of the instrumentation filter logic.
  832. Bit 0 = Enable instrumentation
  833. Bit 1 = Enable syscall instrumentation
  834. Bit 2 = Enable IRQ instrumentation
  835. Bit 3 = Enable collecting syscall arguments
  836. endif # SCHED_INSTRUMENTATION
  837. endmenu # Performance Monitoring
  838. menu "Files and I/O"
  839. config DEV_CONSOLE
  840. bool "Enable /dev/console"
  841. default y
  842. ---help---
  843. Set if architecture-specific logic provides /dev/console at boot-up
  844. time. Enables stdout, stderr, stdin in the start-up application.
  845. You need this setting if your console device is ready at boot time.
  846. For example, if you are using a serial console, then /dev/console
  847. (aka, /dev/ttyS0) will be available when the application first starts.
  848. You must not select DEV_CONSOLE if you console device comes up later
  849. and is not ready until after the application starts. At this time,
  850. the only console device that behaves this way is a USB serial console.
  851. When the application first starts, the USB is (probably) not yet
  852. connected and /dev/console will not be created until later when the
  853. host connects to the USB console.
  854. config FDCLONE_DISABLE
  855. bool "Disable cloning of file descriptors"
  856. default n
  857. ---help---
  858. Disable cloning of all file descriptors by task_create() when a new
  859. ask is started. If set, all files/drivers will appear to be closed
  860. in the new task.
  861. config FDCLONE_STDIO
  862. bool "Disable clone file descriptors without stdio"
  863. default n
  864. ---help---
  865. Disable cloning of all but the first three file descriptors (stdin,
  866. stdout, stderr) by task_create() when a new task is started. If set,
  867. all files/drivers will appear to be closed in the new task except
  868. for stdin, stdout, and stderr.
  869. config SDCLONE_DISABLE
  870. bool "Disable cloning of socket descriptors"
  871. default n
  872. ---help---
  873. Disable cloning of all socket
  874. descriptors by task_create() when a new task is started. If
  875. set, all sockets will appear to be closed in the new task.
  876. config NFILE_DESCRIPTORS
  877. int "Maximum number of file descriptors per task"
  878. default 16
  879. range 3 99999
  880. ---help---
  881. The maximum number of file descriptors per task (one for each open)
  882. config FILE_STREAM
  883. bool "Enable FILE stream"
  884. default y
  885. ---help---
  886. Enable the standard buffered input/output support
  887. config NAME_MAX
  888. int "Maximum size of a file name"
  889. default 32
  890. ---help---
  891. The maximum size of a file name.
  892. config PATH_MAX
  893. int "Maximum size of path name"
  894. default 256
  895. ---help---
  896. The maximum size of path name.
  897. endmenu # Files and I/O
  898. menuconfig PRIORITY_INHERITANCE
  899. bool "Enable priority inheritance "
  900. default n
  901. ---help---
  902. Set to enable support for priority inheritance on mutexes and semaphores.
  903. When this option is enabled, the initial configuration of all seamphores
  904. and mutexes will be with priority inheritance enabled. That configuration
  905. may not be appropriate in all cases (such as when the semaphore or mutex
  906. is used for signaling). In such cases, priority inheritance can be
  907. disabled for individual semaphores by calling:
  908. int ret = sem_setprotocol(&sem, SEM_PRIO_NONE);
  909. From applications, the functionally equivalent OS internal interface,
  910. nxsem_set_protocol(), should be used within the OS
  911. And for individual pthread mutexes by setting the protocol attribute
  912. before initializing the mutex:
  913. int ret = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_NONE);
  914. if PRIORITY_INHERITANCE
  915. config SEM_PREALLOCHOLDERS
  916. int "Number of pre-allocated holders"
  917. default 16
  918. ---help---
  919. This setting is only used if priority inheritance is enabled.
  920. It defines the maximum number of different threads (minus one) that
  921. can take counts on a semaphore with priority inheritance support.
  922. This may be set to zero if priority inheritance is disabled OR if you
  923. are only using semaphores as mutexes (only one holder) OR if no more
  924. than two threads participate using a counting semaphore.
  925. config SEM_NNESTPRIO
  926. int "Maximum number of higher priority threads"
  927. default 16
  928. ---help---
  929. If priority inheritance is enabled, then this setting is the
  930. maximum number of higher priority threads (minus 1) than can be
  931. waiting for another thread to release a count on a semaphore.
  932. This value may be set to zero if no more than one thread is
  933. expected to wait for a semaphore.
  934. endif # PRIORITY_INHERITANCE
  935. menu "RTOS hooks"
  936. config BOARD_EARLY_INITIALIZE
  937. bool "Custom board early initialization"
  938. default n
  939. ---help---
  940. There are three points in time where you can insert custom,
  941. board-specific initialization logic:
  942. 1) <arch>_board_initialize(): This function is used only for
  943. initialization of very low-level things like configuration of
  944. GPIO pins, power setting. The OS has not been initialized
  945. at this point, so you cannot allocate memory or initialize
  946. device drivers at this phase.
  947. 2) The next level of initialization is performed by a call to
  948. up_initialize() (in arch/<arch>/src/common/up_initialize.c).
  949. The OS has been initialized at this point and it is okay to
  950. initialize drivers in this phase.
  951. At this same point in time, the OS will also call a board-
  952. specific initialization function named board_early_initialize()
  953. if CONFIG_BOARD_EARLY_INITIALIZE is selected. The context in
  954. which board_early_initialize() executes is suitable for early
  955. initialization of most, simple device drivers and is a logical,
  956. board-specific extension of up_initialize().
  957. board_early_initialize() runs on the startup, initialization thread.
  958. Some initialization operations cannot be performed on the start-up,
  959. initialization thread. That is because the initialization thread
  960. cannot wait for event. Waiting may be required, for example, to
  961. mount a file system or or initialize a device such as an SD card.
  962. For this reason, such driver initialize must be deferred to
  963. board_late_initialize().
  964. 3) And, finally, just before the user application code starts.
  965. If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
  966. initialization call will be performed in the boot-up sequence to a
  967. function called board_late_initialize(). board_late_initialize()
  968. will be called after up_initialize() is called and just before the
  969. main application is started. This additional initialization
  970. phase may be used, for example, to initialize more complex,
  971. board-specific device drivers.
  972. Waiting for events, use of I2C, SPI, etc are permissible in the
  973. context of board_late_initialize(). That is because
  974. board_late_initialize() will run on a temporary, internal kernel
  975. thread.
  976. config BOARD_LATE_INITIALIZE
  977. bool "Custom board late initialization"
  978. default n
  979. ---help---
  980. There are three points in time where you can insert custom,
  981. board-specific initialization logic:
  982. 1) <arch>_board_initialize(): This function is used only for
  983. initialization of very low-level things like configuration of
  984. GPIO pins, power setting. The OS has not been initialized
  985. at this point, so you cannot allocate memory or initialize
  986. device drivers at this phase.
  987. 2) The next level of initialization is performed by a call to
  988. up_initialize() (in arch/<arch>/src/common/up_initialize.c).
  989. The OS has been initialized at this point and it is okay to
  990. initialize drivers in this phase.
  991. At this same point in time, the OS will also call a board-
  992. specific initialization function named board_early_initialize()
  993. if CONFIG_BOARD_EARLY_INITIALIZE is selected. The context in
  994. which board_early_initialize() executes is suitable for early
  995. initialization of most, simple device drivers and is a logical,
  996. board-specific extension of up_initialize().
  997. board_early_initialize() runs on the startup, initialization thread.
  998. Some initialization operations cannot be performed on the start-up,
  999. initialization thread. That is because the initialization thread
  1000. cannot wait for event. Waiting may be required, for example, to
  1001. mount a file system or or initialize a device such as an SD card.
  1002. For this reason, such driver initialize must be deferred to
  1003. board_late_initialize().
  1004. 3) And, finally, just before the user application code starts.
  1005. If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
  1006. initialization call will be performed in the boot-up sequence to a
  1007. function called board_late_initialize(). board_late_initialize()
  1008. will be called after up_initialize() is called and just before the
  1009. main application is started. This additional initialization
  1010. phase may be used, for example, to initialize more complex,
  1011. board-specific device drivers.
  1012. Waiting for events, use of I2C, SPI, etc are permissible in the
  1013. context of board_late_initialize(). That is because
  1014. board_late_initialize() will run on a temporary, internal kernel
  1015. thread.
  1016. if BOARD_LATE_INITIALIZE
  1017. config BOARD_INITTHREAD_STACKSIZE
  1018. int "Board initialization thread stack size"
  1019. default DEFAULT_TASK_STACKSIZE
  1020. ---help---
  1021. The size of the stack to allocate when starting the board
  1022. initialization thread.
  1023. config BOARD_INITTHREAD_PRIORITY
  1024. int "Board initialization thread priority"
  1025. default 240
  1026. ---help---
  1027. The priority of the board initialization thread. This priority is
  1028. not a critical setting. No other application threads will be
  1029. started until the board initialization is completed. Hence, there
  1030. is very little competition for the CPU.
  1031. endif # BOARD_LATE_INITIALIZE
  1032. config SCHED_STARTHOOK
  1033. bool "Enable startup hook"
  1034. default n
  1035. ---help---
  1036. Enable a non-standard, internal OS API call nxtask_starthook().
  1037. nxtask_starthook() registers a function that will be called on task
  1038. startup before that actual task entry point is called. The
  1039. starthook is useful, for example, for setting up automatic
  1040. configuration of C++ constructors.
  1041. config SCHED_ATEXIT
  1042. bool "Enable atexit() API"
  1043. default n
  1044. ---help---
  1045. Enables the atexit() API
  1046. config SCHED_ATEXIT_MAX
  1047. int "Max number of atexit() functions"
  1048. default 1
  1049. depends on SCHED_ATEXIT && !SCHED_ONEXIT
  1050. ---help---
  1051. By default if SCHED_ATEXIT is selected, only a single atexit() function
  1052. is supported. That number can be increased by defined this setting to
  1053. the number that you require.
  1054. If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit() is built
  1055. on top of the on_exit() implementation. In that case, SCHED_ONEXIT_MAX
  1056. determines the size of the combined number of atexit(0) and on_exit calls
  1057. and SCHED_ATEXIT_MAX is not used.
  1058. config SCHED_ONEXIT
  1059. bool "Enable on_exit() API"
  1060. default n
  1061. ---help---
  1062. Enables the on_exit() API
  1063. config SCHED_ONEXIT_MAX
  1064. int "Max number of on_exit() functions"
  1065. default 1
  1066. depends on SCHED_ONEXIT
  1067. ---help---
  1068. By default if SCHED_ONEXIT is selected, only a single on_exit() function
  1069. is supported. That number can be increased by defined this setting to the
  1070. number that you require.
  1071. If both SCHED_ONEXIT and SCHED_ATEXIT are selected, then atexit() is built
  1072. on top of the on_exit() implementation. In that case, SCHED_ONEXIT_MAX
  1073. determines the size of the combined number of atexit(0) and on_exit calls.
  1074. endmenu # RTOS hooks
  1075. menu "Signal Configuration"
  1076. config SIG_EVTHREAD
  1077. bool "Support SIGEV_THHREAD"
  1078. default n
  1079. depends on BUILD_FLAT && SCHED_WORKQUEUE
  1080. ---help---
  1081. Built in support for the SIGEV_THREAD signal deliver method.
  1082. NOTE: The current implementation uses a work queue to notify the
  1083. client. This, however, would only work in the FLAT build. A
  1084. different mechanism would need to be development to support this
  1085. feature on the PROTECTED or KERNEL build.
  1086. config SIG_EVTHREAD_HPWORK
  1087. bool "SIGEV_EVTHREAD use HPWORK"
  1088. default n
  1089. depends on SIG_EVTHREAD && CONFIG_SCHED_HPWORK
  1090. ---help---
  1091. if selected, SIGEV_THHREAD will use the high priority work queue.
  1092. If not, it will use the low priority work queue (if available).
  1093. REVISIT: This solution is non-optimal. Some notifications should
  1094. be high priority and others should be lower priority. Ideally, you
  1095. should be able to determine which work queue is used on a
  1096. notification-by-notification basis.
  1097. menuconfig SIG_DEFAULT
  1098. bool "Default signal actions"
  1099. default n
  1100. ---help---
  1101. Enable to support default signal actions.
  1102. if SIG_DEFAULT
  1103. comment "Per-signal Default Actions"
  1104. config SIG_SIGUSR1_ACTION
  1105. bool "SIGUSR1"
  1106. default n
  1107. ---help---
  1108. Enable the default action for SIGUSR1 (terminate the task)
  1109. Make sure that your applications are expecting this POSIX behavior.
  1110. Backward compatible behavior would require that the application use
  1111. sigaction() to ignore SIGUSR1.
  1112. config SIG_SIGUSR2_ACTION
  1113. bool "SIGUSR2"
  1114. default n
  1115. ---help---
  1116. Enable the default action for SIGUSR2 (terminate the task)
  1117. Make sure that your applications are expecting this POSIX behavior.
  1118. Backward compatible behavior would require that the application use
  1119. sigaction() to ignore SIGUSR2.
  1120. config SIG_SIGALRM_ACTION
  1121. bool "SIGALRM"
  1122. default n
  1123. ---help---
  1124. Enable the default action for SIGALRM (terminate the task)
  1125. Make sure that your applications are expecting this POSIX behavior.
  1126. Backward compatible behavior would require that the application use
  1127. sigaction() to ignore SIGALRM.
  1128. config SIG_SIGPOLL_ACTION
  1129. bool "SIGPOLL"
  1130. default n
  1131. depends on FS_AIO
  1132. ---help---
  1133. Enable the default action for SIGPOLL (terminate the task)
  1134. Make sure that your applications are expecting this POSIX behavior.
  1135. Backward compatible behavior would require that the application use
  1136. sigaction() to ignore SIGPOLL.
  1137. config SIG_SIGSTOP_ACTION
  1138. bool "SIGSTOP SIGSTP, and SIGCONT"
  1139. default y
  1140. ---help---
  1141. Enable the default action for SIGSTOP and SIGSTP (suspend the
  1142. task) and SIGCONT (resume the task).
  1143. config SIG_SIGKILL_ACTION
  1144. bool "SIGINT SIGKILL SIGQUIT and SIGTERM"
  1145. default y
  1146. ---help---
  1147. Enable the default action for SIGINT and SIGKILL (terminate the
  1148. task).
  1149. config SIG_SIGPIPE_ACTION
  1150. bool "SIGPIPE"
  1151. default y
  1152. ---help---
  1153. Enable the default action for SIGPIPE (terminate the task).
  1154. endif # SIG_DEFAULT
  1155. menu "Signal Numbers"
  1156. comment "Standard Signal Numbers"
  1157. config SIG_SIGUSR1
  1158. int "SIGUSR1"
  1159. default 1
  1160. ---help---
  1161. Value of standard user signal 1 (SIGUSR1). Default: 1
  1162. config SIG_SIGUSR2
  1163. int "SIGUSR2"
  1164. default 2
  1165. ---help---
  1166. Value of standard user signal 2 (SIGUSR2). Default: 2
  1167. config SIG_SIGALRM
  1168. int "SIGALRM"
  1169. default 3
  1170. ---help---
  1171. Default the signal number used with POSIX timers (SIGALRM).
  1172. Default: 3
  1173. config SIG_SIGCHLD
  1174. int "SIGCHLD"
  1175. default 4
  1176. depends on SCHED_HAVE_PARENT
  1177. ---help---
  1178. The SIGCHLD signal is sent to the parent of a child process when it
  1179. exits, is interrupted (stopped), or resumes after being interrupted.
  1180. Default: 4
  1181. config SIG_POLL
  1182. int "SIGPOLL"
  1183. default 5
  1184. depends on FS_AIO
  1185. ---help---
  1186. The SIGPOLL signal is sent to a process when an asynchronous I/O
  1187. event occurs (meaning it has been polled). Default: 5
  1188. if SIG_DEFAULT
  1189. config SIG_STOP
  1190. int "SIGSTOP"
  1191. default 6
  1192. depends on SIG_SIGSTOP_ACTION
  1193. ---help---
  1194. Suspend/pause a task. SIGSTOP may not be caught or ignored.
  1195. config SIG_STP
  1196. int "SIGSTP"
  1197. default 7
  1198. depends on SIG_SIGSTOP_ACTION
  1199. ---help---
  1200. Suspend/pause a task. Unlike SIGSTOP, this signal can be caught or
  1201. ignored.
  1202. config SIG_CONT
  1203. int "SIGCONT"
  1204. default 8
  1205. depends on SIG_SIGSTOP_ACTION
  1206. ---help---
  1207. Resume a suspended/paused task. SIGSTOP only has an action when
  1208. send to a stopped task. SIGCONT is ignored by other task. SIGCONT
  1209. may not be caught or ignored by a stopped task.
  1210. config SIG_KILL
  1211. int "SIGKILL"
  1212. default 9
  1213. depends on SIG_SIGKILL_ACTION
  1214. ---help---
  1215. The SIGKILL signal is sent to cause a task termination event.
  1216. SIGKILL may not be caught or ignored.
  1217. config SIG_INT
  1218. int "SIGINT"
  1219. default 10
  1220. depends on SIG_SIGKILL_ACTION
  1221. ---help---
  1222. The SIGINT signal is sent to cause a task termination event.
  1223. SIGINT may be ignored or caught by the receiving task.
  1224. config SIG_QUIT
  1225. int "SIGQUIT"
  1226. default 11
  1227. depends on SIG_SIGKILL_ACTION
  1228. ---help---
  1229. The SIGINT signal is sent to cause a task termination event.
  1230. SIGQUIT may be ignored or caught by the receiving task.
  1231. config SIG_TERM
  1232. int "SIGTERM"
  1233. default 12
  1234. depends on SIG_SIGKILL_ACTION
  1235. ---help---
  1236. The SIGINT signal is sent to cause a task termination event.
  1237. SIGTERM may be ignored or caught by the receiving task.
  1238. endif # SIG_DEFAULT
  1239. config SIG_PIPE
  1240. int "SIGPIPE"
  1241. default 13
  1242. ---help---
  1243. The SIGPIPE signal is sent to a task termination event.
  1244. This signal is generated when write on a pipe with no one to read it.
  1245. SIGPIPE may be ignored.
  1246. comment "Non-standard Signal Numbers"
  1247. config SIG_SIGCONDTIMEDOUT
  1248. int "SIGCONDTIMEDOUT"
  1249. default 16
  1250. depends on !DISABLE_PTHREAD
  1251. ---help---
  1252. This non-standard signal number is used the implementation of
  1253. pthread_cond_timedwait(). Default 16.
  1254. config SIG_SIGWORK
  1255. int "SIGWORK"
  1256. default 17
  1257. depends on SCHED_WORKQUEUE || LIB_USRWORK
  1258. ---help---
  1259. SIGWORK is a non-standard signal used to wake up the internal NuttX
  1260. worker thread. This setting specifies the signal number that will be
  1261. used for SIGWORK. Default: 17
  1262. endmenu # Signal Numbers
  1263. endmenu # Signal Configuration
  1264. menu "POSIX Message Queue Options"
  1265. depends on !DISABLE_MQUEUE
  1266. config PREALLOC_MQ_MSGS
  1267. int "Number of pre-allocated messages"
  1268. default 4
  1269. ---help---
  1270. The number of pre-allocated message structures. The system manages
  1271. a pool of preallocated message structures to minimize dynamic allocations
  1272. config MQ_MAXMSGSIZE
  1273. int "Maximum message size"
  1274. default 32
  1275. ---help---
  1276. Message structures are allocated with a fixed payload size given by this
  1277. setting (does not include other message structure overhead.
  1278. endmenu # POSIX Message Queue Options
  1279. config MODULE
  1280. bool "Enable loadable OS modules"
  1281. default n
  1282. select LIBC_MODLIB
  1283. select ARCH_USE_MODULE_TEXT if ARCH_HAVE_MODULE_TEXT
  1284. ---help---
  1285. Enable support for loadable OS modules. Default: n
  1286. menu "Work queue support"
  1287. config SCHED_WORKQUEUE
  1288. # bool "Enable worker thread"
  1289. bool
  1290. default n
  1291. ---help---
  1292. Create dedicated "worker" threads to handle delayed or asynchronous
  1293. processing.
  1294. config WQUEUE_NOTIFIER
  1295. bool "Generic work notifier"
  1296. default n
  1297. depends on SCHED_WORKQUEUE
  1298. ---help---
  1299. Enable building of work queue notifier logic that will execute a
  1300. worker function an event occurs. This is is a general purpose
  1301. notifier, but was developed specifically to support poll() logic
  1302. where the poll must wait for an resources to become available.
  1303. config SCHED_HPWORK
  1304. bool "High priority (kernel) worker thread"
  1305. default n
  1306. select SCHED_WORKQUEUE
  1307. ---help---
  1308. Create a dedicated high-priority "worker" thread to handle delayed
  1309. processing from interrupt handlers. This feature is required for
  1310. some drivers but, if there are no complaints, can be safely
  1311. disabled. The high priority worker thread also performs garbage
  1312. collection -- completing any delayed memory deallocations from
  1313. interrupt handlers. If the high-priority worker thread is disabled,
  1314. then that clean up will be performed either by (1) the low-priority
  1315. worker thread, if enabled, and if not (2) the IDLE thread instead
  1316. (which runs at the lowest of priority and may not be appropriate if
  1317. memory reclamation is of high priority)
  1318. For other, less-critical asynchronous or delayed process, the
  1319. low-priority worker thread is recommended.
  1320. if SCHED_HPWORK
  1321. config SCHED_HPNTHREADS
  1322. int "Number of high-priority worker threads"
  1323. default 1
  1324. ---help---
  1325. This options selects multiple, high-priority threads. This is
  1326. essentially a "thread pool" that provides multi-threaded servicing
  1327. of the high-priority work queue. This breaks the serialization
  1328. of the "queue" (hence, it is no longer a queue at all).
  1329. CAUTION: Some drivers may use the work queue to serialize
  1330. operations. They may also use the high-priority work queue if it is
  1331. available. If there are multiple high-priority worker threads, then
  1332. this can result in the loss of that serialization. There may be
  1333. concurrent driver operations running on different HP threads and
  1334. this could lead to a failure. You may need to visit the use of the
  1335. HP work queue on your configuration is you select
  1336. CONFIG_SCHED_HPNTHREADS > 1
  1337. config SCHED_HPWORKPRIORITY
  1338. int "High priority worker thread priority"
  1339. default 224
  1340. ---help---
  1341. The execution priority of the higher priority worker thread.
  1342. The higher priority worker thread is intended to serve as the
  1343. "bottom" half for device drivers. As a consequence it must run at
  1344. a very high, fixed priority. Typically, it should be the highest
  1345. priority thread in your system. Default: 224
  1346. For lower priority, application oriented worker thread support,
  1347. please consider enabling the lower priority work queue. The lower
  1348. priority work queue runs at a lower priority, of course, but has
  1349. the added advantage that it supports "priority inheritance" (if
  1350. PRIORITY_INHERITANCE is also selected): The priority of the lower
  1351. priority worker thread can then be adjusted to match the highest
  1352. priority client.
  1353. config SCHED_HPWORKSTACKSIZE
  1354. int "High priority worker thread stack size"
  1355. default DEFAULT_TASK_STACKSIZE
  1356. ---help---
  1357. The stack size allocated for the worker thread. Default: 2K.
  1358. endif # SCHED_HPWORK
  1359. config SCHED_LPWORK
  1360. bool "Low priority (kernel) worker thread"
  1361. default n
  1362. select SCHED_WORKQUEUE
  1363. ---help---
  1364. If SCHED_LPWORK is defined then a lower-priority work queue will
  1365. be created. This lower priority work queue is better suited for
  1366. more extended, application oriented processing (such as file system
  1367. clean-up operations or asynchronous I/O)
  1368. if SCHED_LPWORK
  1369. config SCHED_LPNTHREADS
  1370. int "Number of low-priority worker threads"
  1371. default 1 if !FS_AIO
  1372. default 4 if FS_AIO
  1373. ---help---
  1374. This options selects multiple, low-priority threads. This is
  1375. essentially a "thread pool" that provides multi-threaded servicing
  1376. of the low-priority work queue. This breaks the serialization
  1377. of the "queue" (hence, it is no longer a queue at all).
  1378. This options is required to support, for example, I/O operations
  1379. that stall waiting for input. If there is only a single thread,
  1380. then the entire low-priority queue processing stalls in such cases.
  1381. Such behavior is necessary to support asynchronous I/O, AIO (for
  1382. example).
  1383. CAUTION: Some drivers may use the work queue to serialize
  1384. operations. They may also use the low-priority work queue if it is
  1385. available. If there are multiple low-priority worker threads, then
  1386. this can result in the loss of that serialization. There may be
  1387. concurrent driver operations running on different LP threads and
  1388. this could lead to a failure. You may need to visit the use of the
  1389. LP work queue on your configuration is you select
  1390. CONFIG_SCHED_LPNTHREADS > 1
  1391. config SCHED_LPWORKPRIORITY
  1392. int "Low priority worker thread priority"
  1393. default 100
  1394. ---help---
  1395. The minimum execution priority of the lower priority worker thread.
  1396. The lower priority worker thread is intended support application-
  1397. oriented functions. The lower priority work queue runs at a lower
  1398. priority, of course, but has the added advantage that it supports
  1399. "priority inheritance" (if PRIORITY_INHERITANCE is also selected):
  1400. The priority of the lower priority worker thread can then be
  1401. adjusted to match the highest priority client. Default: 100
  1402. NOTE: This priority inheritance feature is not automatic. The
  1403. lower priority worker thread will always a fixed priority unless
  1404. you implement logic that calls lpwork_boostpriority() to raise the
  1405. priority of the lower priority worker thread (typically called
  1406. before scheduling the work) and then call the matching
  1407. lpwork_restorepriority() when the work is completed (typically
  1408. called within the work handler at the completion of the work).
  1409. Currently, only the NuttX asynchronous I/O logic uses this dynamic
  1410. prioritization feature.
  1411. The higher priority worker thread, on the other hand, is intended
  1412. to serve as the "bottom" half for device drivers. As a consequence
  1413. it must run at a very high, fixed priority. Typically, it should
  1414. be the highest priority thread in your system.
  1415. config SCHED_LPWORKPRIOMAX
  1416. int "Low priority worker thread maximum priority"
  1417. default 176
  1418. depends on PRIORITY_INHERITANCE
  1419. ---help---
  1420. The maximum execution priority of the lower priority worker thread.
  1421. The lower priority worker thread is intended support application-
  1422. oriented functions. The lower priority work queue runs at a lower
  1423. priority, of course, but has the added advantage that it supports
  1424. "priority inheritance" (if PRIORITY_INHERITANCE is also selected):
  1425. The priority of the lower priority worker thread can then be
  1426. adjusted to match the highest priority client.
  1427. The higher priority worker thread, on the other hand, is intended
  1428. to serve as the "bottom" half for device drivers. As a consequence
  1429. it must run at a very high, fixed priority. Typically, it should
  1430. be the highest priority thread in your system.
  1431. This value provides an upper limit on the priority of the lower
  1432. priority worker thread. This would be necessary, for example, if
  1433. the higher priority worker thread were to defer work to the lower
  1434. priority thread. Clearly, in such a case, you would want to limit
  1435. the maximum priority of the lower priority work thread. Default:
  1436. 176
  1437. config SCHED_LPWORKSTACKSIZE
  1438. int "Low priority worker thread stack size"
  1439. default DEFAULT_TASK_STACKSIZE
  1440. ---help---
  1441. The stack size allocated for the lower priority worker thread. Default: 2K.
  1442. endif # SCHED_LPWORK
  1443. endmenu # Work Queue Support
  1444. menu "Stack and heap information"
  1445. config IDLETHREAD_STACKSIZE
  1446. int "Idle thread stack size"
  1447. default 1024
  1448. ---help---
  1449. The size of the initial stack used by the IDLE thread. The IDLE thread
  1450. is the thread that (1) performs the initial boot of the system up to the
  1451. point where start-up application is spawned, and (2) there after is the
  1452. IDLE thread that executes only when there is no other thread ready to run.
  1453. config PTHREAD_STACK_MIN
  1454. int "Minimum pthread stack size"
  1455. default 256
  1456. ---help---
  1457. Minimum pthread stack size
  1458. config PTHREAD_STACK_DEFAULT
  1459. int "Default pthread stack size"
  1460. default DEFAULT_TASK_STACKSIZE
  1461. ---help---
  1462. Default pthread stack size
  1463. endmenu # Stack and heap information