From bed10d9288e1c61599580049d63fe74873c08b37 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 2 Feb 2013 23:56:54 +0000 Subject: Correct a memory leak in NSH git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5600 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/exec_builtin.c | 32 +++++++++++++++-------- apps/nshlib/nsh_parse.c | 14 ++++++++++ nuttx/configs/amber/README.txt | 2 +- nuttx/configs/avr32dev1/README.txt | 2 +- nuttx/configs/cloudctrl/README.txt | 2 +- nuttx/configs/demo9s12ne64/README.txt | 2 +- nuttx/configs/ea3131/README.txt | 2 +- nuttx/configs/ea3152/README.txt | 2 +- nuttx/configs/eagle100/README.txt | 2 +- nuttx/configs/ekk-lm3s9b96/README.txt | 2 +- nuttx/configs/fire-stm32v2/README.txt | 2 +- nuttx/configs/hymini-stm32v/README.txt | 2 +- nuttx/configs/kwikstik-k40/README.txt | 2 +- nuttx/configs/lincoln60/README.txt | 2 +- nuttx/configs/lm3s6432-s2e/README.txt | 2 +- nuttx/configs/lm3s6965-ek/README.txt | 2 +- nuttx/configs/lm3s8962-ek/README.txt | 2 +- nuttx/configs/lpc4330-xplorer/README.txt | 2 +- nuttx/configs/lpcxpresso-lpc1768/README.txt | 2 +- nuttx/configs/mbed/README.txt | 2 +- nuttx/configs/mcu123-lpc214x/README.txt | 2 +- nuttx/configs/micropendous3/README.txt | 2 +- nuttx/configs/mirtoo/README.txt | 2 +- nuttx/configs/mx1ads/README.txt | 2 +- nuttx/configs/ne64badge/README.txt | 2 +- nuttx/configs/ntosd-dm320/README.txt | 2 +- nuttx/configs/nucleus2g/README.txt | 2 +- nuttx/configs/olimex-lpc1766stk/README.txt | 2 +- nuttx/configs/pcblogic-pic32mx/README.txt | 4 +-- nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c | 34 ++++++++++++------------- nuttx/configs/pic32-starterkit/README.txt | 2 +- nuttx/configs/pic32mx7mmb/README.txt | 2 +- nuttx/configs/sam3u-ek/README.txt | 2 +- nuttx/configs/shenzhou/README.txt | 2 +- nuttx/configs/stm3210e-eval/README.txt | 2 +- nuttx/configs/stm3220g-eval/README.txt | 2 +- nuttx/configs/stm3240g-eval/README.txt | 2 +- nuttx/configs/stm32f100rc_generic/README.txt | 2 +- nuttx/configs/stm32f4discovery/README.txt | 2 +- nuttx/configs/sure-pic32mx/README.txt | 2 +- nuttx/configs/teensy/README.txt | 2 +- nuttx/configs/twr-k60n512/README.txt | 2 +- nuttx/configs/ubw32/README.txt | 2 +- nuttx/configs/us7032evb1/README.txt | 2 +- nuttx/configs/vsn/README.txt | 2 +- nuttx/configs/zp214xpa/README.txt | 2 +- nuttx/fs/fat/fs_fat32.c | 14 +++++++++- nuttx/sched/sched_getfiles.c | 16 ++++++++++-- nuttx/sched/task_posixspawn.c | 12 ++++++++- nuttx/sched/task_spawn.c | 27 +++++++++++++++----- 50 files changed, 155 insertions(+), 82 deletions(-) diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 1924687e3..c262b43da 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -140,16 +140,16 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, /* Initialize attributes for task_spawn(). */ - ret = posix_spawn_file_actions_init(&file_actions); + ret = posix_spawnattr_init(&attr); if (ret != 0) { goto errout_with_errno; } - ret = posix_spawnattr_init(&attr); + ret = posix_spawn_file_actions_init(&file_actions); if (ret != 0) { - goto errout_with_errno; + goto errout_with_attrs; } /* Set the correct task size and priority */ @@ -158,13 +158,13 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, ret = posix_spawnattr_setschedparam(&attr, ¶m); if (ret != 0) { - goto errout_with_errno; + goto errout_with_actions; } ret = task_spawnattr_setstacksize(&attr, builtin->stacksize); if (ret != 0) { - goto errout_with_errno; + goto errout_with_actions; } /* If robin robin scheduling is enabled, then set the scheduling policy @@ -175,7 +175,7 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, ret = posix_spawnattr_setschedpolicy(&attr, SCHED_RR); if (ret != 0) { - goto errout_with_errno; + goto errout_with_actions; } ret = posix_spawnattr_setflags(&attr, @@ -183,13 +183,13 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, POSIX_SPAWN_SETSCHEDULER); if (ret != 0) { - goto errout_with_errno; + goto errout_with_actions; } #else ret = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSCHEDPARAM); if (ret != 0) { - goto errout_with_errno; + goto errout_with_actions; } #endif @@ -204,7 +204,7 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, if (ret != 0) { sdbg("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret); - goto errout_with_errno; + goto errout_with_actions; } } @@ -216,16 +216,28 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv, if (ret != 0) { sdbg("ERROR: task_spawn failed: %d\n", ret); - goto errout_with_errno; + goto errout_with_actions; } + /* Free attibutes and file actions. Ignoring return values in the case + * of an error. + */ + /* Return the task ID of the new task if the task was sucessfully * started. Otherwise, ret will be ERROR (and the errno value will * be set appropriately). */ + (void)posix_spawn_file_actions_destroy(&file_actions); + (void)posix_spawnattr_destroy(&attr); return pid; +errout_with_actions: + (void)posix_spawn_file_actions_destroy(&file_actions); + +errout_with_attrs: + (void)posix_spawnattr_destroy(&attr); + errout_with_errno: set_errno(ret); return ERROR; diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index f679d9b32..26b41e89b 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -1424,6 +1424,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) * successfully). So certainly it is not an NSH command. */ + /* Free the redirected output file path */ + + nsh_freefullpath(redirfile); + redirfile = NULL; + + /* Save the result: success if 0; failure if 1 */ + return nsh_saveresult(vtbl, ret != OK); } @@ -1458,6 +1465,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) * successfully). So certainly it is not an NSH command. */ + /* Free the redirected output file path */ + + nsh_freefullpath(redirfile); + redirfile = NULL; + + /* Save the result: success if 0; failure if 1 */ + return nsh_saveresult(vtbl, ret != OK); } diff --git a/nuttx/configs/amber/README.txt b/nuttx/configs/amber/README.txt index 9f40dcdd2..7f1771886 100644 --- a/nuttx/configs/amber/README.txt +++ b/nuttx/configs/amber/README.txt @@ -490,7 +490,7 @@ Amber Web Server Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Amber Web Server configuration is maintained in a sudirectory and can +Each Amber Web Server configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/avr32dev1/README.txt b/nuttx/configs/avr32dev1/README.txt index 1f52ff0c2..3583efee7 100644 --- a/nuttx/configs/avr32dev1/README.txt +++ b/nuttx/configs/avr32dev1/README.txt @@ -431,7 +431,7 @@ AVR32DEV1 Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Atmel AVR32DEV configuration is maintained in a sudirectory and +Each Atmel AVR32DEV configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/cloudctrl/README.txt b/nuttx/configs/cloudctrl/README.txt index f931f3a12..116bf6b53 100644 --- a/nuttx/configs/cloudctrl/README.txt +++ b/nuttx/configs/cloudctrl/README.txt @@ -726,7 +726,7 @@ Cloudctrl-specific Configuration Options Configurations ============== -Each Cloudctrl configuration is maintained in a sudirectory and +Each Cloudctrl configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/demo9s12ne64/README.txt b/nuttx/configs/demo9s12ne64/README.txt index a9579e909..96872f980 100644 --- a/nuttx/configs/demo9s12ne64/README.txt +++ b/nuttx/configs/demo9s12ne64/README.txt @@ -358,7 +358,7 @@ HCS12/DEMO9S12NEC64-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Freescale HCS12 configuration is maintained in a sudirectory and +Each Freescale HCS12 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ea3131/README.txt b/nuttx/configs/ea3131/README.txt index f11caab4f..c04cf8999 100644 --- a/nuttx/configs/ea3131/README.txt +++ b/nuttx/configs/ea3131/README.txt @@ -605,7 +605,7 @@ ARM/EA3131-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each EA3131 configuration is maintained in a sudirectory and can be +Each EA3131 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ea3152/README.txt b/nuttx/configs/ea3152/README.txt index 8ede86b4f..793df4367 100644 --- a/nuttx/configs/ea3152/README.txt +++ b/nuttx/configs/ea3152/README.txt @@ -411,7 +411,7 @@ ARM/EA3152-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each EA3152 configuration is maintained in a sudirectory and can be +Each EA3152 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt index 8ed581e98..a2d79b43d 100644 --- a/nuttx/configs/eagle100/README.txt +++ b/nuttx/configs/eagle100/README.txt @@ -383,7 +383,7 @@ Eagle100-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Eagle-100 configuration is maintained in a sudirectory and +Each Eagle-100 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ekk-lm3s9b96/README.txt b/nuttx/configs/ekk-lm3s9b96/README.txt index 01aa1496c..dfd212854 100644 --- a/nuttx/configs/ekk-lm3s9b96/README.txt +++ b/nuttx/configs/ekk-lm3s9b96/README.txt @@ -402,7 +402,7 @@ Configurations ^^^^^^^^^^^^^^ Each Stellaris EKK-LM3S9b96 Evaluation Kit configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh ekk-lm3s9b96/ diff --git a/nuttx/configs/fire-stm32v2/README.txt b/nuttx/configs/fire-stm32v2/README.txt index d12a9b27d..101657f64 100644 --- a/nuttx/configs/fire-stm32v2/README.txt +++ b/nuttx/configs/fire-stm32v2/README.txt @@ -810,7 +810,7 @@ M3 Wildfire-specific Configuration Options Configurations ============== -Each M3 Wildfire configuration is maintained in a sudirectory and +Each M3 Wildfire configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/hymini-stm32v/README.txt b/nuttx/configs/hymini-stm32v/README.txt index 9b063d0ff..0613e7e03 100644 --- a/nuttx/configs/hymini-stm32v/README.txt +++ b/nuttx/configs/hymini-stm32v/README.txt @@ -560,7 +560,7 @@ HY-Mini specific Configuration Options Configurations ============== -Each HY-MiniSTM32V configuration is maintained in a sudirectory and +Each HY-MiniSTM32V configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/kwikstik-k40/README.txt b/nuttx/configs/kwikstik-k40/README.txt index 98e738d80..e4170de9b 100644 --- a/nuttx/configs/kwikstik-k40/README.txt +++ b/nuttx/configs/kwikstik-k40/README.txt @@ -511,7 +511,7 @@ KwikStik-K40-specific Configuration Options Configurations ============== -Each KwikStik-K40 configuration is maintained in a sudirectory and +Each KwikStik-K40 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/lincoln60/README.txt b/nuttx/configs/lincoln60/README.txt index 159753890..ad35c11c3 100644 --- a/nuttx/configs/lincoln60/README.txt +++ b/nuttx/configs/lincoln60/README.txt @@ -473,7 +473,7 @@ the mountpoint /mnt/flash. Configurations ^^^^^^^^^^^^^^ -Each Lincoln 60 configuration is maintained in a sudirectory and can be selected +Each Lincoln 60 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/lm3s6432-s2e/README.txt b/nuttx/configs/lm3s6432-s2e/README.txt index 7241856b0..357c6b56e 100644 --- a/nuttx/configs/lm3s6432-s2e/README.txt +++ b/nuttx/configs/lm3s6432-s2e/README.txt @@ -405,7 +405,7 @@ Configurations ^^^^^^^^^^^^^^ Each Stellaris MDL-S2E Reference Design configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh lm3s6432-s2e/ diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 94cf4d902..cae350365 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -545,7 +545,7 @@ Configurations ^^^^^^^^^^^^^^ Each Stellaris LM3S6965 Evaluation Kit configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh lm3s6965-ek/ diff --git a/nuttx/configs/lm3s8962-ek/README.txt b/nuttx/configs/lm3s8962-ek/README.txt index e8a0091c6..82135e809 100644 --- a/nuttx/configs/lm3s8962-ek/README.txt +++ b/nuttx/configs/lm3s8962-ek/README.txt @@ -449,7 +449,7 @@ Configurations ^^^^^^^^^^^^^^ Each Stellaris LM3S8962 Evaluation Kit configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh lm3s8962-ek/ diff --git a/nuttx/configs/lpc4330-xplorer/README.txt b/nuttx/configs/lpc4330-xplorer/README.txt index 65f382009..a88758d6c 100644 --- a/nuttx/configs/lpc4330-xplorer/README.txt +++ b/nuttx/configs/lpc4330-xplorer/README.txt @@ -893,7 +893,7 @@ LPC4330-Xplorer Configuration Options Configurations ============== -Each LPC4330-Xplorer configuration is maintained in a sudirectory and can be selected +Each LPC4330-Xplorer configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/lpcxpresso-lpc1768/README.txt b/nuttx/configs/lpcxpresso-lpc1768/README.txt index 1d9c0cbc2..f45c1ccc2 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/README.txt +++ b/nuttx/configs/lpcxpresso-lpc1768/README.txt @@ -734,7 +734,7 @@ LPCXpresso Configuration Options Configurations ^^^^^^^^^^^^^^ -Each LPCXpresso configuration is maintained in a sudirectory and can be +Each LPCXpresso configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/mbed/README.txt b/nuttx/configs/mbed/README.txt index a5390a1d7..604838e28 100644 --- a/nuttx/configs/mbed/README.txt +++ b/nuttx/configs/mbed/README.txt @@ -444,7 +444,7 @@ the mountpoint /mnt/flash. Configurations ^^^^^^^^^^^^^^ -Each mbed configuration is maintained in a sudirectory and can be selected +Each mbed configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/mcu123-lpc214x/README.txt b/nuttx/configs/mcu123-lpc214x/README.txt index 1c6c9bde8..1acade72e 100644 --- a/nuttx/configs/mcu123-lpc214x/README.txt +++ b/nuttx/configs/mcu123-lpc214x/README.txt @@ -320,7 +320,7 @@ ARM/LPC214X-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each NXP LPC214x configuration is maintained in a sudirectory and +Each NXP LPC214x configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/micropendous3/README.txt b/nuttx/configs/micropendous3/README.txt index 6b586bd64..298a4aa46 100644 --- a/nuttx/configs/micropendous3/README.txt +++ b/nuttx/configs/micropendous3/README.txt @@ -510,7 +510,7 @@ Micropendous3 Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Micropendous3 configuration is maintained in a sudirectory and can +Each Micropendous3 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/mirtoo/README.txt b/nuttx/configs/mirtoo/README.txt index 6d3ea234e..e5b33a9b5 100644 --- a/nuttx/configs/mirtoo/README.txt +++ b/nuttx/configs/mirtoo/README.txt @@ -849,7 +849,7 @@ PIC32MX Configuration Options Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/mx1ads/README.txt b/nuttx/configs/mx1ads/README.txt index 661d4e812..e2ecd74d3 100644 --- a/nuttx/configs/mx1ads/README.txt +++ b/nuttx/configs/mx1ads/README.txt @@ -121,7 +121,7 @@ ARM/i.MX1-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each MX1ADS configuration is maintained in a sudirectory and +Each MX1ADS configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ne64badge/README.txt b/nuttx/configs/ne64badge/README.txt index 34e8a6dc5..83ae75027 100644 --- a/nuttx/configs/ne64badge/README.txt +++ b/nuttx/configs/ne64badge/README.txt @@ -465,7 +465,7 @@ HCS12/NE64BADGE-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Freescale HCS12 configuration is maintained in a sudirectory and +Each Freescale HCS12 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ntosd-dm320/README.txt b/nuttx/configs/ntosd-dm320/README.txt index 675716154..0335d7124 100644 --- a/nuttx/configs/ntosd-dm320/README.txt +++ b/nuttx/configs/ntosd-dm320/README.txt @@ -282,7 +282,7 @@ ARM/DM320-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Neuros OSD configuration is maintained in a sudirectory and +Each Neuros OSD configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/nucleus2g/README.txt b/nuttx/configs/nucleus2g/README.txt index e915e8bdd..d1b3a8f9a 100644 --- a/nuttx/configs/nucleus2g/README.txt +++ b/nuttx/configs/nucleus2g/README.txt @@ -521,7 +521,7 @@ Configurations ^^^^^^^^^^^^^^ Each Nucleus 2G configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh nucleus2g/ diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index 990d1141a..005f62dc9 100644 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -849,7 +849,7 @@ Configurations ^^^^^^^^^^^^^^ Each Olimex LPC1766-STK configuration is maintained in a -sudirectory and can be selected as follow: +sub-directory and can be selected as follow: cd tools ./configure.sh olimex-lpc1766stk/ diff --git a/nuttx/configs/pcblogic-pic32mx/README.txt b/nuttx/configs/pcblogic-pic32mx/README.txt index bd81f0c42..5fd4ba6f2 100644 --- a/nuttx/configs/pcblogic-pic32mx/README.txt +++ b/nuttx/configs/pcblogic-pic32mx/README.txt @@ -159,7 +159,7 @@ MAX3232 Connection RX -- Pin 52: U1RX/RF2 GND -- POWER POINT: GND Vcc -- POWER POINT: Vdd (3.3V) -- Or P32_VBUS (+5V) - -- Or +5V from a USB PC port. + Or +5V from a USB PC port. Toolchains ========== @@ -524,7 +524,7 @@ PIC32MX Configuration Options Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c b/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c index 3f99baee1..b8af46ee7 100644 --- a/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c +++ b/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c @@ -40,25 +40,25 @@ /* LCD pin mapping (see configs/pcblogic-pic32mx/README.txt) * * ----------------------------------- ---------- ---------------------------------- - * PIC32 LCD1602 UBW32 PIN + * PIC32 LCD1602 PCBLogic PIN * PIN SIGNAL NAME PIN NAME(s) * ----------------------------------- ---------- ---------------------------------- - * 1. Vss GND - * 2. Vdd Vcc (5V) - * 3. Vee To ground via 10K potentiometer - * 4 AN15/OCFB/PMALL/PMA0/CN12/RB15 4. RS PMA0, Selects registers - * 82 PMRD/CN14/RD5 5. RW PMRD/PMWR, Selects read or write - * 81 OC5/PMWR/CN13/RD4 6. E PMENB, Starts data read/write - * 93 PMD0/RE0 7. D0 PMD0 - * 94 PMD1/RE1 8. D1 PMD1 - * 98 PMD2/RE2 9. D2 PMD2 - * 99 PMD3/RE3 10. D3 PMD3 - * 100 PMD4/RE4 11. D4 PMD4 - * 3 PMD5/RE5 12. D5 PMD5 - * 4 PMD6/RE6 13. D6 PMD6 - * 5 PMD7/RE7 14. D7 PMD7 - * 15. A To Vcc (5V) via 10K potentiometer - * 16. K GND + * 1. Vss --> Powerpoint GND + * 2. Vdd --> Powerpoint USB+5V + * 3. Vee N/C To ground via 10K potentiometer + * 4 AN15/OCFB/PMALL/PMA0/CN12/RB15 4. RS 4 PMA0, Selects registers + * 82 PMRD/CN14/RD5 5. RW 82 PMRD/PMWR, Selects read or write + * 81 OC5/PMWR/CN13/RD4 6. E 81 PMENB, Starts data read/write + * 93 PMD0/RE0 7. D0 93 PMD0 + * 94 PMD1/RE1 8. D1 94 PMD1 + * 98 PMD2/RE2 9. D2 98 PMD2 + * 99 PMD3/RE3 10. D3 99 PMD3 + * 100 PMD4/RE4 11. D4 100 PMD4 + * 3 PMD5/RE5 12. D5 3 PMD5 + * 4 PMD6/RE6 13. D6 4 PMD6 + * 5 PMD7/RE7 14. D7 5 PMD7 + * 15. A N/C To Vcc (5V) via 10K potentiometer + * 16. K --> Powerpoint GND * ----------------------------------- ---------- ---------------------------------- */ diff --git a/nuttx/configs/pic32-starterkit/README.txt b/nuttx/configs/pic32-starterkit/README.txt index ea82a166b..6a1f6b4c1 100644 --- a/nuttx/configs/pic32-starterkit/README.txt +++ b/nuttx/configs/pic32-starterkit/README.txt @@ -1021,7 +1021,7 @@ PIC32MX specific PHY/Ethernet device driver settings Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/pic32mx7mmb/README.txt b/nuttx/configs/pic32mx7mmb/README.txt index 211206525..8701ac170 100644 --- a/nuttx/configs/pic32mx7mmb/README.txt +++ b/nuttx/configs/pic32mx7mmb/README.txt @@ -599,7 +599,7 @@ PIC32MX specific PHY/Ethernet device driver settings Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/sam3u-ek/README.txt b/nuttx/configs/sam3u-ek/README.txt index d8d190804..d89293100 100644 --- a/nuttx/configs/sam3u-ek/README.txt +++ b/nuttx/configs/sam3u-ek/README.txt @@ -355,7 +355,7 @@ SAM3U-EK-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each SAM3U-EK configuration is maintained in a sudirectory and +Each SAM3U-EK configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/shenzhou/README.txt b/nuttx/configs/shenzhou/README.txt index a15d2f915..df360ff8a 100644 --- a/nuttx/configs/shenzhou/README.txt +++ b/nuttx/configs/shenzhou/README.txt @@ -743,7 +743,7 @@ Shenzhou-specific Configuration Options Configurations ============== -Each Shenzhou configuration is maintained in a sudirectory and +Each Shenzhou configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt index f494e9e9a..789a599d1 100644 --- a/nuttx/configs/stm3210e-eval/README.txt +++ b/nuttx/configs/stm3210e-eval/README.txt @@ -680,7 +680,7 @@ STM3210E-EVAL-specific Configuration Options Configurations ============== -Each STM3210E-EVAL configuration is maintained in a sudirectory and +Each STM3210E-EVAL configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/stm3220g-eval/README.txt b/nuttx/configs/stm3220g-eval/README.txt index 40c918582..679049e82 100644 --- a/nuttx/configs/stm3220g-eval/README.txt +++ b/nuttx/configs/stm3220g-eval/README.txt @@ -776,7 +776,7 @@ STM3220G-EVAL-specific Configuration Options Configurations ============== -Each STM3220G-EVAL configuration is maintained in a sudirectory and +Each STM3220G-EVAL configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt index e8a3c4b25..485ce12ff 100644 --- a/nuttx/configs/stm3240g-eval/README.txt +++ b/nuttx/configs/stm3240g-eval/README.txt @@ -912,7 +912,7 @@ STM3240G-EVAL-specific Configuration Options Configurations ============== -Each STM3240G-EVAL configuration is maintained in a sudirectory and +Each STM3240G-EVAL configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/stm32f100rc_generic/README.txt b/nuttx/configs/stm32f100rc_generic/README.txt index 951fb3130..01af178a6 100644 --- a/nuttx/configs/stm32f100rc_generic/README.txt +++ b/nuttx/configs/stm32f100rc_generic/README.txt @@ -454,7 +454,7 @@ configured on pins PA3 and PA2, respectively. Configurations ============== -Each STMicro STM32F100RC generic configuration is maintained in a sudirectory +Each STMicro STM32F100RC generic configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 25a770012..5629d8c4a 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1003,7 +1003,7 @@ STM32F4Discovery-specific Configuration Options Configurations ============== -Each STM32F4Discovery configuration is maintained in a sudirectory and +Each STM32F4Discovery configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/sure-pic32mx/README.txt b/nuttx/configs/sure-pic32mx/README.txt index 403fe42ba..a3721e2de 100644 --- a/nuttx/configs/sure-pic32mx/README.txt +++ b/nuttx/configs/sure-pic32mx/README.txt @@ -596,7 +596,7 @@ PIC32MX Configuration Options Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/teensy/README.txt b/nuttx/configs/teensy/README.txt index 23e7d6c98..df1cad81a 100644 --- a/nuttx/configs/teensy/README.txt +++ b/nuttx/configs/teensy/README.txt @@ -513,7 +513,7 @@ Teensy++ Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Teensy++ configuration is maintained in a sudirectory and can +Each Teensy++ configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/twr-k60n512/README.txt b/nuttx/configs/twr-k60n512/README.txt index a9db7a1f7..5fb00a2f9 100644 --- a/nuttx/configs/twr-k60n512/README.txt +++ b/nuttx/configs/twr-k60n512/README.txt @@ -645,7 +645,7 @@ TWR-K60N512-specific Configuration Options Configurations ============== -Each TWR-K60N512 configuration is maintained in a sudirectory and +Each TWR-K60N512 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/ubw32/README.txt b/nuttx/configs/ubw32/README.txt index 63cb1bb54..5c41b8275 100644 --- a/nuttx/configs/ubw32/README.txt +++ b/nuttx/configs/ubw32/README.txt @@ -569,7 +569,7 @@ PIC32MX Configuration Options Configurations ============== -Each PIC32MX configuration is maintained in a sudirectory and can be +Each PIC32MX configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/us7032evb1/README.txt b/nuttx/configs/us7032evb1/README.txt index 0a25790ba..6821cc425 100644 --- a/nuttx/configs/us7032evb1/README.txt +++ b/nuttx/configs/us7032evb1/README.txt @@ -55,7 +55,7 @@ shterm Configurations ^^^^^^^^^^^^^^ -Each SH-1 configuration is maintained in a sudirectory and +Each SH-1 configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/vsn/README.txt b/nuttx/configs/vsn/README.txt index debc3e8ad..3331f0cd5 100644 --- a/nuttx/configs/vsn/README.txt +++ b/nuttx/configs/vsn/README.txt @@ -290,7 +290,7 @@ VSN-specific Configuration Options Configurations ^^^^^^^^^^^^^^ -Each VSN configuration is maintained in a sudirectory and +Each VSN configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/configs/zp214xpa/README.txt b/nuttx/configs/zp214xpa/README.txt index 88d03b9de..7ccfcaf3d 100644 --- a/nuttx/configs/zp214xpa/README.txt +++ b/nuttx/configs/zp214xpa/README.txt @@ -282,7 +282,7 @@ Using OpenOCD and GDB with an FT2232 JTAG emulator Configurations: =============== - Each NXP LPC214x configuration is maintained in a sudirectory and + Each NXP LPC214x configuration is maintained in a sub-directory and can be selected as follow: cd tools diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index df8962b51..7202bb63d 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -637,9 +637,21 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer, int sectorindex; int ret; - /* Sanity checks */ + /* Sanity checks. I have seen the following assertion misfire if + * CONFIG_DEBUG_MM is enabled while re-directing output to a + * file. In this case, the debug output can get generated while + * the file is being opened, FAT data structures are being allocated, + * and things are generally in a perverse state. + */ +#ifdef CONFIG_DEBUG_MM + if (filep->f_priv == NULL || filep->f_inode == NULL) + { + return -ENXIO; + } +#else DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); +#endif /* Recover our private data from the struct file instance */ diff --git a/nuttx/sched/sched_getfiles.c b/nuttx/sched/sched_getfiles.c index 17ca2bbf6..95f5c44ec 100644 --- a/nuttx/sched/sched_getfiles.c +++ b/nuttx/sched/sched_getfiles.c @@ -72,8 +72,20 @@ FAR struct filelist *sched_getfiles(void) FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; FAR struct task_group_s *group = rtcb->group; - DEBUGASSERT(group); - return &group->tg_filelist; + /* The group may be NULL under certain conditions. For example, if + * debug output is attempted from the IDLE thead before the group has + * been allocated. I have only seen this case when memory management + * debug is enabled. + */ + + if (group) + { + return &group->tg_filelist; + } + + /* Higher level logic must handle the NULL gracefully */ + + return NULL; } #endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/sched/task_posixspawn.c b/nuttx/sched/task_posixspawn.c index f26391500..1b3afdaf3 100644 --- a/nuttx/sched/task_posixspawn.c +++ b/nuttx/sched/task_posixspawn.c @@ -166,6 +166,16 @@ errout: * Description: * Perform file_actions, then execute the task from the file system. * + * Do we really need this proxy task? Isn't that wasteful? + * + * Q: Why not use a starthook so that there is callout from task_start() + * to perform these operations after the file is loaded from + * the file system? + * A: That existing task_starthook() implementation cannot be used in + * this context; any of task_starthook() will also conflict with + * binfmt's use of the start hook to call C++ static initializers. + * task_restart() would also be an issue. + * * Input Parameters: * Standard task start-up parameters * @@ -399,7 +409,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, return errcode; } - /* Disable pre-emption so that the proxy does not run until we waitpid + /* Disable pre-emption so that the proxy does not run until waitpid * is called. This is probably unnecessary since the posix_spawn_proxy has * the same priority as this thread; it should be schedule behind this * task in the ready-to-run list. diff --git a/nuttx/sched/task_spawn.c b/nuttx/sched/task_spawn.c index 04a3944bf..61a835c91 100644 --- a/nuttx/sched/task_spawn.c +++ b/nuttx/sched/task_spawn.c @@ -110,8 +110,6 @@ static int task_spawn_exec(FAR pid_t *pidp, FAR const char *name, int pid; int ret = OK; - DEBUGASSERT(path); - /* Disable pre-emption so that we can modify the task parameters after * we start the new task; the new task will not actually begin execution * until we re-enable pre-emption. @@ -159,6 +157,23 @@ errout: * Description: * Perform file_actions, then execute the task from the file system. * + * Do we really need a proxy task in this case? Isn't that wasteful? + * + * Q: Why can we do what we need to do here and the just call the + * new task's entry point. + * A: This would require setting up the name, priority, and stacksize from + * the task_spawn, but it do-able. The only issue I can think of is + * that NuttX supports task_restart(), and you would never be able to + * restart a task from this point. + * + * Q: Why not use a starthook so that there is callout from task_start() + * to perform these operations? + * A: Good idea, except that existing task_starthook() implementation + * cannot be used here unless we get rid of task_create and, instead, + * use task_init() and task_activate(). start_taskhook() could then + * be called between task_init() and task)activate(). task_restart() + * would still be an issue. + * * Input Parameters: * Standard task start-up parameters * @@ -303,10 +318,8 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry, #endif int ret; - DEBUGASSERT(path); - - svdbg("pid=%p path=%s file_actions=%p attr=%p argv=%p\n", - pid, path, file_actions, attr, argv); + svdbg("pid=%p name=%s entry=%p file_actions=%p attr=%p argv=%p\n", + pid, name, entry, file_actions, attr, argv); /* If there are no file actions to be performed and there is no change to * the signal mask, then start the new child task directly from the parent task. @@ -359,7 +372,7 @@ int task_spawn(FAR pid_t *pid, FAR const char *name, main_t entry, return errcode; } - /* Disable pre-emption so that the proxy does not run until we waitpid + /* Disable pre-emption so that the proxy does not run until waitpid * is called. This is probably unnecessary since the task_spawn_proxy has * the same priority as this thread; it should be schedule behind this * task in the ready-to-run list. -- cgit v1.2.3